mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 14:23:36 -05:00
Attempt 3 at fixing disconnections :)
* Added limit of 10kB for Certificate size. If it is bigger - discard certificate. * Remove certificates for slow / trickle connections (for Relay connections). git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4822 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
761bca8678
commit
611db96fb9
@ -434,11 +434,33 @@ void AuthGPGimpl::processServices()
|
||||
#endif
|
||||
|
||||
/* save the certificate to string */
|
||||
#define DISABLE_CERTIFICATE_SEND 1
|
||||
/*****
|
||||
* #define DISABLE_CERTIFICATE_SEND 1
|
||||
****/
|
||||
|
||||
#define LIMIT_CERTIFICATE_SIZE 1
|
||||
#define MAX_CERTIFICATE_SIZE 10000
|
||||
|
||||
#ifdef DISABLE_CERTIFICATE_SEND
|
||||
std::cerr << "AuthGPGimpl::processServices() Certificates Disabled" << std::endl;
|
||||
loadOrSave->m_certGpg = "";
|
||||
#else
|
||||
loadOrSave->m_certGpg = SaveCertificateToString(loadOrSave->m_certGpgId,true);
|
||||
std::cerr << "AuthGPGimpl::processServices() Cert for: " << loadOrSave->m_certGpgId;
|
||||
std::cerr << " is " << loadOrSave->m_certGpg.size() << " bytes";
|
||||
std::cerr << std::endl;
|
||||
|
||||
#ifdef LIMIT_CERTIFICATE_SIZE
|
||||
if (loadOrSave->m_certGpg.size() > MAX_CERTIFICATE_SIZE)
|
||||
{
|
||||
std::cerr << "AuthGPGimpl::processServices() Cert for: " << loadOrSave->m_certGpgId;
|
||||
std::cerr << " is over size limit - removing";
|
||||
std::cerr << std::endl;
|
||||
|
||||
loadOrSave->m_certGpg = "";
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -975,14 +975,30 @@ void p3disc::setGPGOperation(AuthGPGOperation *operation)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Send off message
|
||||
item->certGPG = loadOrSave->m_certGpg;
|
||||
/* for Relay Connections (and other slow ones) we don't want to
|
||||
* to waste bandwidth sending certificates. So don't add it.
|
||||
*/
|
||||
|
||||
uint32_t linkType = mLinkMgr->getLinkType(item->PeerId());
|
||||
if ((linkType & RS_NET_CONN_SPEED_TRICKLE) ||
|
||||
(linkType & RS_NET_CONN_SPEED_LOW))
|
||||
{
|
||||
std::cerr << "p3disc::setGPGOperation() Send DiscReply Packet to: ";
|
||||
std::cerr << item->PeerId();
|
||||
std::cerr << " without Certificate (low bandwidth)" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Attaching Certificate.
|
||||
item->certGPG = loadOrSave->m_certGpg;
|
||||
}
|
||||
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "p3disc::setGPGOperation() About to Send Message:" << std::endl;
|
||||
item->print(std::cerr, 5);
|
||||
#endif
|
||||
|
||||
// Send off message
|
||||
sendItem(item);
|
||||
|
||||
#ifdef P3DISC_DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user