mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 10:54:22 -05:00
Revert "Ad a friend right upon connection when necessary. Removed two core mutex to do that, it might be dangerous, we will see"
This reverts commit 430b13ab7d12b0911e072887c8347b6855d173af. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2042 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1c23a2fb2c
commit
5349ab101a
@ -2185,10 +2185,10 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
|
|||||||
//sslcert *cert = NULL;
|
//sslcert *cert = NULL;
|
||||||
std::string certId;
|
std::string certId;
|
||||||
getX509id(X509_STORE_CTX_get_current_cert(ctx), certId);
|
getX509id(X509_STORE_CTX_get_current_cert(ctx), certId);
|
||||||
// if (!mConnMgr->isFriend(certId)) {
|
if (!mConnMgr->isFriend(certId)) {
|
||||||
// //we've got a new ssl id
|
//we've got a new ssl id
|
||||||
// preverify_ok = false;
|
preverify_ok = false;
|
||||||
// }
|
}
|
||||||
|
|
||||||
//is the connection was initiated by us, then it was for a specific peer id wich is stored is in the context
|
//is the connection was initiated by us, then it was for a specific peer id wich is stored is in the context
|
||||||
//check that the peerid in the context is the same as the cert one
|
//check that the peerid in the context is the same as the cert one
|
||||||
@ -2211,13 +2211,13 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add, even if it might already be added
|
//just to be sure
|
||||||
mConnMgr->addFriend(certId, getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer));
|
mConnMgr->addFriend(certId, getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer));
|
||||||
|
|
||||||
//set location
|
//set location
|
||||||
mConnMgr->setLocation(certId, getX509LocString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->subject));
|
mConnMgr->setLocation(certId, getX509LocString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->subject));
|
||||||
|
|
||||||
//Check if peer isn't already connected
|
//Cgheck if peer isn't already connected
|
||||||
peerConnectState detail;
|
peerConnectState detail;
|
||||||
if (mConnMgr->getFriendNetStatus(certId, detail)) {
|
if (mConnMgr->getFriendNetStatus(certId, detail)) {
|
||||||
if (detail.state & RS_PEER_CONNECTED && detail.connecttype & RS_NET_CONN_TUNNEL) {
|
if (detail.state & RS_PEER_CONNECTED && detail.connecttype & RS_NET_CONN_TUNNEL) {
|
||||||
|
@ -2005,24 +2005,23 @@ bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMod
|
|||||||
/* (1) already exists */
|
/* (1) already exists */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* so four possibilities
|
/* so four possibilities
|
||||||
* (1) already exists as friend -> do nothing.
|
* (1) already exists as friend -> do nothing.
|
||||||
* (2) is in others list -> move over.
|
* (2) is in others list -> move over.
|
||||||
* (3) is non-existant -> create new one.
|
* (3) is non-existant -> create new one.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONN_DEBUG
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "p3ConnectMgr::addFriend() " << id << "; gpg_id : " << gpg_id << std::endl;
|
std::cerr << "p3ConnectMgr::addFriend() " << id << "; gpg_id : " << gpg_id << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONN_DEBUG
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "p3ConnectMgr::addFriend() removing dummy friend" << std::endl;
|
std::cerr << "p3ConnectMgr::addFriend() removing dummy friend" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
//remove any dummy friend because we just add a real ssl friend
|
//remove any dummy friend because we just add a real ssl friend
|
||||||
removeFriend("dummy"+ gpg_id);
|
removeFriend("dummy"+ gpg_id);
|
||||||
|
|
||||||
{
|
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
|
||||||
|
|
||||||
|
|
||||||
std::map<std::string, peerConnectState>::iterator it;
|
std::map<std::string, peerConnectState>::iterator it;
|
||||||
@ -2115,10 +2114,6 @@ bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMod
|
|||||||
|
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
|
||||||
}
|
|
||||||
//usefull because we might add a friend by receiving an ssl connection, so we want the monitors to act right now
|
|
||||||
tickMonitors();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ int pqihandler::status()
|
|||||||
|
|
||||||
bool pqihandler::AddSearchModule(SearchModule *mod)
|
bool pqihandler::AddSearchModule(SearchModule *mod)
|
||||||
{
|
{
|
||||||
//RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/ This might be dangerous, but usefull for accepting new frinds right upon connection
|
RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
|
||||||
// if peerid used -> error.
|
// if peerid used -> error.
|
||||||
std::map<std::string, SearchModule *>::iterator it;
|
std::map<std::string, SearchModule *>::iterator it;
|
||||||
if (mod->peerid != mod->pqi->PeerId())
|
if (mod->peerid != mod->pqi->PeerId())
|
||||||
|
@ -314,7 +314,7 @@ int pqipersongrp::addPeer(std::string id)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SearchModule *sm = NULL;
|
SearchModule *sm = NULL;
|
||||||
{ //RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/ This might be dangerous, but usefull for accepting new frinds right upon connection
|
{ RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
|
||||||
std::map<std::string, SearchModule *>::iterator it;
|
std::map<std::string, SearchModule *>::iterator it;
|
||||||
it = mods.find(id);
|
it = mods.find(id);
|
||||||
if (it != mods.end())
|
if (it != mods.end())
|
||||||
|
Loading…
Reference in New Issue
Block a user