mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 18:45:17 -04:00
Significant changes to aid UDP connections.
* Added Period and Delay parameters to connections. - Delay is used to avoid simultaneous TCP connections. - Period is used to regulate UDP connections. * added Delay code to pqissl. * added Period code to tcponudp / pqissludp. * modified TTL modification code. * increased SynPktRetransmit value. * fixed retrans() timeout (one reason code wasn't working before!) * fixed tou_close() SEGV bug. * modified pqissludp tou_socket creation. (non permanent now). * Modified format of peerConnectRequest() CB to make it more useful and rewrote function. * Enabled pqissludp NetInterface. * using Id comparision to determine Active/Passive UDP connection state. * added #def to disable TCP connections. (for testing) * enabled UDP connections from retryConnect() function. * corrected EXT check in retryConnect() function. * + lots of debug output and other stuff. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@358 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e87b7b75e7
commit
8b230a55cf
24 changed files with 381 additions and 87 deletions
|
@ -95,6 +95,7 @@ pqissl::pqissl(pqissllistener *l, PQInterface *parent, p3AuthMgr *am, p3ConnectM
|
|||
attempt_ts(0),
|
||||
net_attempt(0), net_failure(0), net_unreachable(0),
|
||||
sameLAN(false), n_read_zero(0),
|
||||
mConnectDelay(0), mConnectTS(0),
|
||||
|
||||
/**************** PQI_USE_XPGP ******************/
|
||||
#if defined(PQI_USE_XPGP)
|
||||
|
@ -246,6 +247,16 @@ int pqissl::reset()
|
|||
return 1;
|
||||
}
|
||||
|
||||
bool pqissl::connect_parameter(uint32_t type, uint32_t value)
|
||||
{
|
||||
if (type == NET_PARAM_CONNECT_DELAY)
|
||||
{
|
||||
mConnectDelay = value;
|
||||
return true;
|
||||
}
|
||||
return NetInterface::connect_parameter(type, value);
|
||||
}
|
||||
|
||||
|
||||
/********** End of Implementation of NetInterface ******************/
|
||||
/********** Implementation of BinInterface **************************
|
||||
|
@ -333,11 +344,18 @@ int pqissl::ConnectAttempt()
|
|||
{
|
||||
case WAITING_NOT:
|
||||
|
||||
sslmode = PQISSL_ACTIVE; /* we're starting this one */
|
||||
|
||||
pqioutput(PQL_DEBUG_BASIC, pqisslzone,
|
||||
"pqissl::ConnectAttempt() STATE = Not Waiting, starting connection");
|
||||
|
||||
case WAITING_DELAY:
|
||||
|
||||
pqioutput(PQL_DEBUG_BASIC, pqisslzone,
|
||||
"pqissl::ConnectAttempt() STATE = Waiting Delay, starting connection");
|
||||
|
||||
sslmode = PQISSL_ACTIVE; /* we're starting this one */
|
||||
return Initiate_Connection();
|
||||
return Delay_Connection();
|
||||
//return Initiate_Connection(); /* now called by Delay_Connection() */
|
||||
|
||||
break;
|
||||
|
||||
|
@ -424,6 +442,62 @@ int pqissl::Failed_Connection()
|
|||
*
|
||||
*/
|
||||
|
||||
int pqissl::Delay_Connection()
|
||||
{
|
||||
pqioutput(PQL_DEBUG_BASIC, pqisslzone,
|
||||
"pqissl::Delay_Connection() Attempting Outgoing Connection....");
|
||||
|
||||
if (waiting == WAITING_NOT)
|
||||
{
|
||||
waiting = WAITING_DELAY;
|
||||
|
||||
/* set delay */
|
||||
if (mConnectDelay == 0)
|
||||
{
|
||||
return Initiate_Connection();
|
||||
}
|
||||
|
||||
/* set Connection TS.
|
||||
*/
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "pqissl::Delay_Connection() ";
|
||||
out << " Delaying Connection to ";
|
||||
out << PeerId() << " for ";
|
||||
out << mConnectDelay;
|
||||
out << " seconds";
|
||||
pqioutput(PQL_DEBUG_BASIC, pqisslzone, out.str());
|
||||
}
|
||||
|
||||
|
||||
mConnectTS = time(NULL) + mConnectDelay;
|
||||
return 0;
|
||||
}
|
||||
else if (waiting == WAITING_DELAY)
|
||||
{
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "pqissl::Delay_Connection() ";
|
||||
out << " Connection to ";
|
||||
out << PeerId() << " starting in ";
|
||||
out << mConnectTS - time(NULL);
|
||||
out << " seconds";
|
||||
pqioutput(PQL_DEBUG_BASIC, pqisslzone, out.str());
|
||||
}
|
||||
|
||||
if (time(NULL) > mConnectTS)
|
||||
{
|
||||
return Initiate_Connection();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
pqioutput(PQL_WARNING, pqisslzone,
|
||||
"pqissl::Initiate_Connection() Already Attempt in Progress!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int pqissl::Initiate_Connection()
|
||||
{
|
||||
int err;
|
||||
|
@ -432,7 +506,7 @@ int pqissl::Initiate_Connection()
|
|||
pqioutput(PQL_DEBUG_BASIC, pqisslzone,
|
||||
"pqissl::Initiate_Connection() Attempting Outgoing Connection....");
|
||||
|
||||
if (waiting != WAITING_NOT)
|
||||
if (waiting != WAITING_DELAY)
|
||||
{
|
||||
pqioutput(PQL_WARNING, pqisslzone,
|
||||
"pqissl::Initiate_Connection() Already Attempt in Progress!");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue