Significant improvements to DHT behaviour, and reconnection attempts.

* Added GUI interface for auto connect state.
 * Added HTTP retrieval and storage of DHT peers update.
 * Added code for partial recv() from DHT peers.
 * Disabled Chat/Disc/Udplayer/tcpstream debug output.
 * Added Unreachable Check to connMgr.
 * Added auto reconnect functions to connMgr (#define to disable).
 * Restructured DHT notify code... much cleaner.
 * DHT now flags out of date DHT results.
 * DHT notifies ConnMgr on any results (same or diff).
 * Added Fns to cleanup old udp connection.
 * other bugfixes.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@369 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-03-02 14:25:59 +00:00
parent 7b3fc2976e
commit 63828f77a8
20 changed files with 708 additions and 203 deletions

View file

@ -39,7 +39,6 @@
/*
* #define DEBUG_TCP_STREAM 1
*/
#define DEBUG_TCP_STREAM 1
/*
*#define DEBUG_TCP_STREAM_EXTRA 1

View file

@ -403,6 +403,7 @@ int tou_close(int sockfd)
/* shut it down */
tous->tcp->close();
udps->removeUdpPeer(tous->tcp);
delete tous->tcp;
}

View file

@ -44,9 +44,9 @@
#include <errno.h>
*/
/*
*/ #define DEBUG_UDP_LAYER 1
/**/
/***
* #define DEBUG_UDP_LAYER 1
***/
static const int UDP_DEF_TTL = 64;

View file

@ -189,6 +189,30 @@ int UdpSorter::addUdpPeer(UdpPeer *peer, const struct sockaddr_in &raddr)
return ok;
}
int UdpSorter::removeUdpPeer(UdpPeer *peer)
{
RsStackMutex stack(sortMtx); /********** LOCK MUTEX *********/
/* check for duplicate */
std::map<struct sockaddr_in, UdpPeer *>::iterator it;
for(it = streams.begin(); it != streams.end(); it++)
{
if (it->second == peer)
{
#ifdef DEBUG_UDP_SORTER
std::cerr << "UdpSorter::removeUdpPeer() SUCCESS" << std::endl;
#endif
streams.erase(it);
return 1;
}
}
#ifdef DEBUG_UDP_SORTER
std::cerr << "UdpSorter::removeUdpPeer() ERROR" << std::endl;
#endif
return 0;
}
/******************************* STUN Handling ********************************/

View file

@ -71,6 +71,7 @@ virtual ~UdpSorter() { return; }
/* add a TCPonUDP stream */
int addUdpPeer(UdpPeer *peer, const struct sockaddr_in &raddr);
int removeUdpPeer(UdpPeer *peer);
bool setStunKeepAlive(uint32_t required);
bool addStunPeer(const struct sockaddr_in &remote, const char *peerid);