process HolePunch

This commit is contained in:
orignal 2014-02-28 21:28:05 -05:00
parent 567816e6a5
commit 48737864a3
2 changed files with 7 additions and 0 deletions

View File

@ -69,6 +69,11 @@ namespace ssu
// relay response // relay response
ProcessRelayResponse (buf,len); ProcessRelayResponse (buf,len);
break; break;
case eSessionRelayResponseReceived:
// HolePunch received
LogPrint ("SSU HolePuch of ", len, " bytes received");
Established ();
break;
case eSessionRelayRequestReceived: case eSessionRelayRequestReceived:
// HolePunch // HolePunch
m_State = eSessionStateUnknown; m_State = eSessionStateUnknown;
@ -386,6 +391,7 @@ namespace ssu
payload += 2; payload += 2;
LogPrint ("Our external address is ", ourIP.to_string (), ":", ourPort); LogPrint ("Our external address is ", ourIP.to_string (), ":", ourPort);
i2p::context.UpdateAddress (ourIP.to_string ().c_str ()); i2p::context.UpdateAddress (ourIP.to_string ().c_str ());
m_State= eSessionRelayResponseReceived;
} }
else else
LogPrint ("Unexpected payload type ", (int)(header->flag >> 4)); LogPrint ("Unexpected payload type ", (int)(header->flag >> 4));

1
SSU.h
View File

@ -57,6 +57,7 @@ namespace ssu
eSessionStateConfirmedReceived, eSessionStateConfirmedReceived,
eSessionRelayRequestSent, eSessionRelayRequestSent,
eSessionRelayRequestReceived, eSessionRelayRequestReceived,
eSessionRelayResponseReceived,
eSessionStateEstablished eSessionStateEstablished
}; };