From 8129d0c5d4173bfca65a6f541fc123923a2adccf Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 5 Jan 2015 19:37:42 +0000 Subject: [PATCH] Fixed inconsistent code (Patch rom G10H4ck) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7821 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/tcponudp/udprelay.cc | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/libretroshare/src/tcponudp/udprelay.cc b/libretroshare/src/tcponudp/udprelay.cc index fb490bc65..6fd5b553b 100644 --- a/libretroshare/src/tcponudp/udprelay.cc +++ b/libretroshare/src/tcponudp/udprelay.cc @@ -143,9 +143,9 @@ int UdpRelayReceiver::removeUdpPeer(UdpPeer *peer) { if (it->second == peer) { + realPeerAddr = it->first; mPeers.erase(it); found = true; - realPeerAddr = it->first; #ifdef DEBUG_UDP_RELAY std::cerr << "UdpRelayReceiver::removeUdpPeer() removing UdpPeer" << std::endl; @@ -1036,20 +1036,17 @@ UdpRelayProxy::UdpRelayProxy() } UdpRelayProxy::UdpRelayProxy(UdpRelayAddrSet *addrSet, int relayClass, uint32_t bandwidth) + : mAddrs(*addrSet), + mRelayClass(relayClass), + mBandwidth(0), + mDataSize(0), + mLastBandwidthTS(0), + mLastTS(time(NULL)), + mStartTS(time(NULL)), + mBandwidthLimit(bandwidth) { - mAddrs = *addrSet; - mRelayClass = relayClass; - - mBandwidth = 0; - mDataSize = 0; - mLastBandwidthTS = 0; - mLastTS = time(NULL); - - - mStartTS = time(NULL); - mBandwidthLimit = bandwidth; - /* fallback */ - if (mBandwidthLimit == 0) + /* bandwidth fallback */ + if (bandwidth == 0) { switch(relayClass) {