From b0756ff8c2cce73c9ffdb41c5815d013883e6532 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 16 Nov 2010 20:50:59 +0000 Subject: [PATCH] limited the number of calls to insertConnect() (costly) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3804 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/NetworkDialog.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 1c48f0767..c0fac0f59 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -362,10 +362,17 @@ void NetworkDialog::updateDisplay() /* get the list of Neighbours from the RsIface. */ void NetworkDialog::insertConnect() { + static time_t last_time = 0 ; + if (!rsPeers) - { return; - } + + // Because this is called from a qt signal, there's no limitation between calls. + time_t now = time(NULL); + if(last_time + 5 > now) // never update more often then every 5 seconds. + return ; + + last_time = now ; std::list neighs; //these are GPG ids std::list::iterator it;