Important changes to tighten up the connection methods:

* Switched to miniupnpc-1.0
 * modified miniupnpc to add lease duration.
 * set lease duration to 1 Hr.
 * Modified configure scripts to use miniupnpc-1.0

 * added TIMEOUT to all connections (5 sec for TCP - Important!)
 * reduced TCP offset delay to 2 seconds.
 * BUGFIX: Added missing connect_parameter wrapper function.
 * added reset to other connection methods when connection is made.
 * Added Connection Type (TCP/UDP) information to feedback/GUI

 * Increased default Data Rates: from 50/50 to 100/500 kB/s
 * Removed Default Bootstrap Ids. (only automatic now!)



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@423 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-03-26 15:35:09 +00:00
parent 8079660291
commit 8d3f9a3ec6
16 changed files with 131 additions and 46 deletions

View file

@ -148,6 +148,7 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
/* find the pqi, */
pqiconnect *pqi = NULL;
uint32_t type = 0;
std::map<uint32_t, pqiconnect *>::iterator it;
/* start again */
@ -167,6 +168,7 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
if ((it->second)->thisNetInterface(ni))
{
pqi = (it->second);
type = (it->first);
}
}
@ -184,7 +186,7 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
/* notify */
if (pqipg)
pqipg->notifyConnect(PeerId(), true);
pqipg->notifyConnect(PeerId(), type, true);
if ((active) && (activepqi != pqi)) // already connected - trouble
{
@ -202,13 +204,20 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
{
pqioutput(PQL_WARNING, pqipersonzone,
"CONNECT_SUCCESS->marking so!");
"CONNECT_SUCCESS->marking so! (resetting others)");
// mark as active.
active = true;
activepqi = pqi;
inConnectAttempt = false;
/* reset all other children? (clear up long UDP attempt) */
for(it = kids.begin(); it != kids.end(); it++)
{
if (it->second != activepqi)
{
it->second->reset();
}
}
return 1;
}
break;
@ -243,7 +252,7 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
/* notify up (But not if we are actually active: rtn -1 case above) */
if (pqipg)
pqipg->notifyConnect(PeerId(), false);
pqipg->notifyConnect(PeerId(), type, false);
return 1;
@ -334,7 +343,7 @@ int pqiperson::stoplistening()
return 1;
}
int pqiperson::connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay, uint32_t period)
int pqiperson::connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay, uint32_t period, uint32_t timeout)
{
{
std::ostringstream out;
@ -342,6 +351,9 @@ int pqiperson::connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay,
out << " type: " << type;
out << " addr: " << inet_ntoa(raddr.sin_addr);
out << ":" << ntohs(raddr.sin_port);
out << " delay: " << delay;
out << " period: " << period;
out << " timeout: " << timeout;
out << std::endl;
std::cerr << out.str();
//pqioutput(PQL_DEBUG_BASIC, pqipersonzone, out.str());
@ -363,8 +375,12 @@ int pqiperson::connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay,
/* set the parameters */
(it->second)->reset();
std::cerr << "pqiperson::connect() setting connect_parameters" << std::endl;
(it->second)->connect_parameter(NET_PARAM_CONNECT_DELAY, delay);
(it->second)->connect_parameter(NET_PARAM_CONNECT_PERIOD, period);
(it->second)->connect_parameter(NET_PARAM_CONNECT_TIMEOUT, timeout);
(it->second)->connect(raddr);
// flag if we started a new connectionAttempt.