From 7007a6737471dc53b63d0330dd45377c5d141fc9 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 9 Aug 2013 21:13:44 +0000 Subject: [PATCH] fixed lobby auto-subscribe by asking for public lobbies at most every 121 seconds. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6574 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/services/p3chatservice.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libretroshare/src/services/p3chatservice.cc b/libretroshare/src/services/p3chatservice.cc index ee6ce6315..81e7a5e6a 100644 --- a/libretroshare/src/services/p3chatservice.cc +++ b/libretroshare/src/services/p3chatservice.cc @@ -60,6 +60,7 @@ static const time_t MAX_KEEP_INACTIVE_NICKNAME = 180 ; // keep inactiv static const time_t MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE = 120 ; // send keep alive packet every 2 minutes. static const time_t MAX_KEEP_PUBLIC_LOBBY_RECORD = 60 ; // keep inactive lobbies records for 60 secs max. static const time_t MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ = 20 ; // don't ask for lobby list more than once every 30 secs. +static const time_t LOBBY_LIST_AUTO_UPDATE_TIME = 121 ; // regularly ask for available lobbies every 5 minutes, to allow auto-subscribe to work static const time_t DISTANT_CHAT_CLEANING_PERIOD = 60 ; // don't ask for lobby list more than once every 30 secs. static const time_t DISTANT_CHAT_KEEP_ALIVE_PERIOD = 10 ; // sens keep alive distant chat packets every 10 secs. @@ -95,6 +96,7 @@ int p3ChatService::tick() static time_t last_clean_time_lobby = 0 ; static time_t last_clean_time_dchat = 0 ; + static time_t last_req_chat_lobby_list = 0 ; time_t now = time(NULL) ; @@ -108,6 +110,15 @@ int p3ChatService::tick() cleanDistantChatInvites() ; last_clean_time_dchat = now ; } + if(last_req_chat_lobby_list + LOBBY_LIST_AUTO_UPDATE_TIME < now) + { + cleanDistantChatInvites() ; + + std::vector visible_lobbies_tmp ; + getListOfNearbyChatLobbies(visible_lobbies_tmp) ; + + last_req_chat_lobby_list = now ; + } // Flush items that could not be sent, probably because of a Mutex protected zone. //