From b2b32be32a9bb37dd92a9c05b7fd5f265f93da15 Mon Sep 17 00:00:00 2001 From: joss17 Date: Thu, 22 Apr 2010 18:50:39 +0000 Subject: [PATCH] Udp connection uses now dynsns when available git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2759 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/p3connmgr.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/libretroshare/src/pqi/p3connmgr.cc b/libretroshare/src/pqi/p3connmgr.cc index 69fa499a2..d8ec72fd0 100644 --- a/libretroshare/src/pqi/p3connmgr.cc +++ b/libretroshare/src/pqi/p3connmgr.cc @@ -2406,6 +2406,32 @@ bool p3ConnectMgr::retryConnectTCP(std::string id) pca.period = 0; it->second.connAddrs.push_back(pca); } + + //add an udp attempt with the dns address + found = false; + for (std::list::iterator cit = it->second.connAddrs.begin(); cit != it->second.connAddrs.end(); cit++) { + if ( cit->type == RS_NET_CONN_UDP) { + #ifdef CONN_DEBUG + rslog(RSL_DEBUG_BASIC, p3connectzone, "p3ConnectMgr::retryConnectTCP() udp attempt already in list."); + #endif + found = true; + break; + } + } + if (!found) { + #ifdef CONN_DEBUG + rslog(RSL_DEBUG_BASIC, p3connectzone, "p3ConnectMgr::retryConnectTCP() Adding udp connection attempt."); + #endif + peerConnectAddress pca; + pca.addr.sin_family = AF_INET; + pca.addr.sin_addr.s_addr = addr.s_addr; + pca.addr.sin_port = port; + pca.type = RS_NET_CONN_UDP; + pca.delay = P3CONNMGR_UDP_DEFAULT_DELAY; + pca.ts = time(NULL); + pca.period = P3CONNMGR_UDP_DEFAULT_PERIOD + (rand() % P3CONNMGR_UDP_DEFAULT_PERIOD); + it->second.connAddrs.push_back(pca); + } } } }