Add some clarifying comments

This commit is contained in:
Tor Lillqvist 2016-04-06 10:23:13 +03:00
parent 41a1c0b3f9
commit 381bd75fe4

View file

@ -1381,6 +1381,8 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
std::unique_lock<std::mutex> sessionsLock(brokerIt.second->_wsSessionsMutex);
for (auto& sessionIt: brokerIt.second->_wsSessions)
{
// If a message has arrived from the client since we last did an idle save,
// and it is more than 30 seconds since the message arrived, do a save.
if (sessionIt.second->_lastMessageTime > sessionIt.second->_idleSaveTime &&
sessionIt.second->_lastMessageTime < now - 30)
{
@ -1403,6 +1405,8 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
std::unique_lock<std::mutex> sessionsLock(brokerIt.second->_wsSessionsMutex);
for (auto& sessionIt: brokerIt.second->_wsSessions)
{
// If messages have arrived from the client since we last did an idle or auto
// save, do a save.
if (sessionIt.second->_lastMessageTime >= sessionIt.second->_idleSaveTime &&
sessionIt.second->_lastMessageTime >= sessionIt.second->_autoSaveTime)
{