mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 02:44:20 -05:00
fix a bug wich stops multiple connection against the same peer
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2201 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ef8cf1d8a6
commit
faa1e15db2
@ -2320,6 +2320,7 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
if (mConnMgr->getFriendNetStatus(certId, detail)) {
|
||||
if (detail.state & RS_PEER_CONNECTED && !(detail.connecttype & RS_NET_CONN_TUNNEL)) {
|
||||
fprintf(stderr, "AuthSSL::VerifyX509Callback this peer is already connected, refuse a new connection.");
|
||||
preverify_ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1124,6 +1124,16 @@ int pqissl::Authorise_SSL_Connection()
|
||||
reset();
|
||||
return -1;
|
||||
}
|
||||
std::string certPeerId;
|
||||
getX509id(peercert, certPeerId);
|
||||
if (certPeerId != PeerId()) {
|
||||
rslog(RSL_WARNING, pqisslzone,
|
||||
"pqissl::Authorise_SSL_Connection() the cert Id doesn't match the Peer id we're trying to connect to.");
|
||||
|
||||
// Failed completely
|
||||
reset();
|
||||
return -1;
|
||||
}
|
||||
|
||||
rslog(RSL_DEBUG_BASIC, pqisslzone,
|
||||
"pqissl::Authorise_SSL_Connection() Have Peer Cert");
|
||||
|
@ -659,7 +659,14 @@ int pqissllistener::completeConnection(int fd, SSL *ssl, struct sockaddr_in &rem
|
||||
if (it -> first == newPeerId)
|
||||
{
|
||||
out << "\t\tMatch!";
|
||||
found = true;
|
||||
//check if peer is not already connected
|
||||
peerConnectState pcs;
|
||||
if (mConnMgr->getFriendNetStatus(newPeerId, pcs) && (pcs.state & RS_PEER_CONNECTED && !(pcs.connecttype & RS_NET_CONN_TUNNEL))) {
|
||||
out << "\t\tPeer is already connected !";
|
||||
break;
|
||||
} else {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user