diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/PeerListenCommand.cc | 2 | ||||
| -rw-r--r-- | src/TorrentMan.cc | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/PeerListenCommand.cc b/src/PeerListenCommand.cc index af680bac..c8f96416 100644 --- a/src/PeerListenCommand.cc +++ b/src/PeerListenCommand.cc @@ -76,7 +76,7 @@ bool PeerListenCommand::execute() { } delete peerSocket; } catch(Exception* ex) { - e->logger->error("CUID#%d - error in accepting connection", cuid, ex); + e->logger->error("CUID#%d - error in accepting connection", ex, cuid); delete ex; if(peerSocket != NULL) { delete peerSocket; diff --git a/src/TorrentMan.cc b/src/TorrentMan.cc index e5b8adbd..43d500dd 100644 --- a/src/TorrentMan.cc +++ b/src/TorrentMan.cc @@ -65,9 +65,6 @@ void TorrentMan::updatePeers(const Peers& peers) { } bool TorrentMan::addPeer(Peer* peer, bool duplicate) { - if(peers.size() >= MAX_PEER_LIST_SIZE) { - return false; - } if(duplicate) { for(Peers::iterator itr = peers.begin(); itr != peers.end(); itr++) { Peer* p = *itr; @@ -76,6 +73,12 @@ bool TorrentMan::addPeer(Peer* peer, bool duplicate) { } } } else { + if(peers.size() >= MAX_PEER_LIST_SIZE) { + deleteOldErrorPeers(100); + if(peers.size() >= MAX_PEER_LIST_SIZE) { + return false; + } + } for(Peers::iterator itr = peers.begin(); itr != peers.end(); itr++) { Peer* p = *itr; if(p->ipaddr == peer->ipaddr && p->port == peer->port) { |
