first commit, change some members name from localaddr to currentlocaladdr, and add ip lists in the classes. Not used yet to connect or exchange

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1804 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2009-11-11 16:43:51 +00:00
parent a444484734
commit 00361c22a5
12 changed files with 156 additions and 115 deletions

View file

@ -108,14 +108,14 @@ int RsServer::UpdateAllConfig()
mConnMgr->getOwnNetStatus(pstate);
/* ports */
config.localAddr = inet_ntoa(pstate.localaddr.sin_addr);
config.localPort = ntohs(pstate.localaddr.sin_port);
config.localAddr = inet_ntoa(pstate.currentlocaladdr.sin_addr);
config.localPort = ntohs(pstate.currentlocaladdr.sin_port);
config.firewalled = true;
config.forwardPort = true;
config.extAddr = inet_ntoa(pstate.serveraddr.sin_addr);
config.extPort = ntohs(pstate.serveraddr.sin_port);
config.extAddr = inet_ntoa(pstate.currentserveraddr.sin_addr);
config.extPort = ntohs(pstate.currentserveraddr.sin_port);
/* data rates */
config.maxDownloadDataRate = (int) pqih -> getMaxRate(true); /* kb */

View file

@ -354,9 +354,10 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
}
}
//TODO : check use of this details
// From all addresses, show the most recent one if no address is currently in use.
struct sockaddr_in best_local_addr = (!strcmp(inet_ntoa(pcs.localaddr.sin_addr),"0.0.0.0"))?getPreferredAddress(pcs.dht.laddr,pcs.dht.ts,pcs.disc.laddr,pcs.disc.ts,pcs.peer.laddr,pcs.peer.ts):pcs.localaddr ;
struct sockaddr_in best_servr_addr = (!strcmp(inet_ntoa(pcs.serveraddr.sin_addr),"0.0.0.0"))?getPreferredAddress(pcs.dht.raddr,pcs.dht.ts,pcs.disc.raddr,pcs.disc.ts,pcs.peer.raddr,pcs.peer.ts):pcs.serveraddr ;
struct sockaddr_in best_local_addr = (!strcmp(inet_ntoa(pcs.currentlocaladdr.sin_addr),"0.0.0.0"))?getPreferredAddress(pcs.dht.laddr,pcs.dht.ts,pcs.disc.laddr,pcs.disc.ts,pcs.peer.laddr,pcs.peer.ts):pcs.currentlocaladdr ;
struct sockaddr_in best_servr_addr = (!strcmp(inet_ntoa(pcs.currentserveraddr.sin_addr),"0.0.0.0"))?getPreferredAddress(pcs.dht.raddr,pcs.dht.ts,pcs.disc.raddr,pcs.disc.ts,pcs.peer.raddr,pcs.peer.ts):pcs.currentserveraddr ;
/* fill from pcs */
@ -430,7 +431,7 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
/*
*/
autostr << "Trying ";
switch(pcs.currentConnAddr.type)
switch(pcs.currentConnAddrAttempt.type)
{
case RS_NET_CONN_TCP_LOCAL:
autostr << "TCP (Local)";
@ -440,7 +441,7 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
break;
case RS_NET_CONN_UDP_DHT_SYNC:
autostr << "UDP (ETA: ";
autostr << 420 - (time(NULL) - pcs.currentConnAddr.ts);
autostr << 420 - (time(NULL) - pcs.currentConnAddrAttempt.ts);
autostr << ")";
break;
default: