mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
update implemention for new ssl encryption
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2427 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
57e2e94f8f
commit
47b5f62aeb
@ -300,7 +300,9 @@ int pqissltunnel::tick()
|
|||||||
// if we are waiting.. continue the connection (only)
|
// if we are waiting.. continue the connection (only)
|
||||||
if (waiting > 0)
|
if (waiting > 0)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_PQISSL_TUNNEL
|
||||||
std::cerr << "pqissltunnel::tick() Continuing Connection Attempt!" << std::endl;
|
std::cerr << "pqissltunnel::tick() Continuing Connection Attempt!" << std::endl;
|
||||||
|
#endif
|
||||||
ConnectAttempt();
|
ConnectAttempt();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -342,9 +344,13 @@ int pqissltunnel::ConnectAttempt()
|
|||||||
|
|
||||||
case TUNNEL_WAITING_PING_RETURN:
|
case TUNNEL_WAITING_PING_RETURN:
|
||||||
if ((time(NULL) - mConnectTS) < TUNNEL_PING_TIMEOUT) {
|
if ((time(NULL) - mConnectTS) < TUNNEL_PING_TIMEOUT) {
|
||||||
|
#ifdef DEBUG_PQISSL_TUNNEL
|
||||||
std::cerr << "pqissltunnel::ConnectAttempt() STATE = Waiting for ping reply." << std::endl;
|
std::cerr << "pqissltunnel::ConnectAttempt() STATE = Waiting for ping reply." << std::endl;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef DEBUG_PQISSL_TUNNEL
|
||||||
std::cerr << "pqissltunnel::ConnectAttempt() no ping reply during imparing time. Connection failed." << std::endl;
|
std::cerr << "pqissltunnel::ConnectAttempt() no ping reply during imparing time. Connection failed." << std::endl;
|
||||||
|
#endif
|
||||||
waiting = TUNNEL_WAITING_NOT;
|
waiting = TUNNEL_WAITING_NOT;
|
||||||
active = false;
|
active = false;
|
||||||
// clean up the streamer
|
// clean up the streamer
|
||||||
@ -452,36 +458,38 @@ void pqissltunnel::IncommingPingPacket(std::string incRelayPeerId) {
|
|||||||
int pqissltunnel::senddata(void *data, int len)
|
int pqissltunnel::senddata(void *data, int len)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_PQISSL_TUNNEL
|
#ifdef DEBUG_PQISSL_TUNNEL
|
||||||
std::cout << "pqissltunnel::senddata() called" << std::endl ;
|
std::cerr << "pqissltunnel::senddata() called" << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
if (!active) {
|
if (!active) {
|
||||||
#ifdef DEBUG_PQISSL_TUNNEL
|
#ifdef DEBUG_PQISSL_TUNNEL
|
||||||
std::cout << "pqissltunnel::senddata() connection is not active" << std::endl ;
|
std::cerr << "pqissltunnel::senddata() connection is not active" << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int outlen = 0;
|
||||||
|
void * out;
|
||||||
|
if (!AuthSSL::getAuthSSL()->encrypt(out, outlen, data, len, parent()->PeerId())) {
|
||||||
|
std::cerr << "pqissltunnel::readdata() problem while crypting packet, ignoring it." << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
std::cerr << "pqissltunnel::readdata() outlen : " << outlen << std::endl;
|
||||||
//create RsTunnelDataItem
|
//create RsTunnelDataItem
|
||||||
RsTunnelDataItem *item = new RsTunnelDataItem;
|
RsTunnelDataItem *item = new RsTunnelDataItem();
|
||||||
item->destPeerId = parent()->PeerId();
|
item->destPeerId = parent()->PeerId();
|
||||||
item->relayPeerId = relayPeerId;
|
item->relayPeerId = relayPeerId;
|
||||||
item->sourcePeerId = mConnMgr->getOwnId();
|
item->sourcePeerId = mConnMgr->getOwnId();
|
||||||
item->PeerId(relayPeerId);
|
item->PeerId(relayPeerId);
|
||||||
item->connection_accepted = 1;
|
item->connection_accepted = 1;
|
||||||
|
item->encoded_data_len = outlen;
|
||||||
|
item->encoded_data = out;
|
||||||
|
|
||||||
int oulen;
|
#ifdef DEBUG_PQISSL_TUNNEL
|
||||||
if (!AuthSSL::getAuthSSL()->encrypt(item->encoded_data, oulen, data, len, parent()->PeerId())) {
|
std::cerr << "pqissltunnel::senddata() sending item (Putting it into queue)" << std::endl ;
|
||||||
std::cerr << "pqissltunnel::readdata() problem while crypting packet, ignoring it." << std::endl;
|
#endif
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
item->encoded_data_len = oulen;
|
|
||||||
|
|
||||||
#ifdef DEBUG_PQISSL_TUNNEL
|
|
||||||
std::cout << "pqissltunnel::senddata() sending item (Putting it into queue)" << std::endl ;
|
|
||||||
#endif
|
|
||||||
mP3tunnel->sendItem(item);
|
mP3tunnel->sendItem(item);
|
||||||
|
|
||||||
return oulen;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pqissltunnel::readdata(void *data, int len)
|
int pqissltunnel::readdata(void *data, int len)
|
||||||
|
Loading…
Reference in New Issue
Block a user