mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 19:12:28 -04:00
Merged Changes /branches/v0.5-peernet/libretroshare/:r4237-4358
Major changes are: * Improvements to tcponudp library to allow multiple UdpStacks / ports, with alternative recievers. * Resurrected the UdpStunner code, and improved it. * Added UdpRelay code. * Modified startup code and ssludp code to use the new tcponudp and add a stunner. * fixed buggy rs_inet_ntoa * fixed a bunch of apple gcc warnings. mainly for(;;); => for(;;) ; These changes shouldn't affect libretroshare stability... those changes will follow! git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4359 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d58f838269
commit
b683e663d6
19 changed files with 1679 additions and 151 deletions
|
@ -57,6 +57,8 @@
|
|||
#include "pqi/sslfns.h"
|
||||
#include "pqi/authgpg.h"
|
||||
|
||||
#include "tcponudp/udpstunner.h"
|
||||
|
||||
class accountId
|
||||
{
|
||||
public:
|
||||
|
@ -1739,6 +1741,8 @@ RsTurtle *rsTurtle = NULL ;
|
|||
#ifdef RS_USE_BITDHT
|
||||
#include "dht/p3bitdht.h"
|
||||
#include "udp/udpstack.h"
|
||||
#include "tcponudp/udppeer.h"
|
||||
#include "tcponudp/udprelay.h"
|
||||
#endif
|
||||
|
||||
/****
|
||||
|
@ -1882,11 +1886,58 @@ int RsServer::StartupRetroShare()
|
|||
}
|
||||
}
|
||||
|
||||
p3BitDht *mBitDht = new p3BitDht(ownId, mConnMgr,
|
||||
mUdpStack, bootstrapfile);
|
||||
/* construct the rest of the stack, important to build them in the correct order! */
|
||||
/* MOST OF THIS IS COMMENTED OUT UNTIL THE REST OF libretroshare IS READY FOR IT! */
|
||||
|
||||
UdpSubReceiver *udpReceivers[3];
|
||||
int udpTypes[3];
|
||||
|
||||
// FIRST DHT STUNNER.
|
||||
UdpStunner *mDhtStunner = new UdpStunner(mUdpStack);
|
||||
mDhtStunner->setTargetStunPeriod(0); /* passive */
|
||||
//mDhtStunner->setTargetStunPeriod(300); /* slow (5mins) */
|
||||
mUdpStack->addReceiver(mDhtStunner);
|
||||
|
||||
// NEXT BITDHT.
|
||||
p3BitDht *mBitDht = new p3BitDht(ownId, mConnMgr, mUdpStack, bootstrapfile);
|
||||
|
||||
// NEXT THE RELAY (NEED to keep a reference for installing RELAYS)
|
||||
//UdpRelayReceiver *mRelayRecver = new UdpRelayReceiver(mUdpStack);
|
||||
//udpReceivers[2] = mRelayRecver; /* RELAY Connections (DHT Port) */
|
||||
//udpTypes[2] = TOU_RECEIVER_TYPE_UDPRELAY;
|
||||
//mUdpStack->addReceiver(udpReceivers[2]);
|
||||
|
||||
// LAST ON THIS STACK IS STANDARD DIRECT TOU
|
||||
udpReceivers[0] = new UdpPeerReceiver(mUdpStack); /* standard DIRECT Connections (DHT Port) */
|
||||
udpTypes[0] = TOU_RECEIVER_TYPE_UDPPEER;
|
||||
mUdpStack->addReceiver(udpReceivers[0]);
|
||||
|
||||
// NOW WE BUILD THE SECOND STACK.
|
||||
// Create the Second UdpStack... Port should be random (but openable!).
|
||||
//struct sockaddr_in sndladdr;
|
||||
//sockaddr_clear(&sndladdr);
|
||||
//sndladdr.sin_port = htons(RsInitConfig::port + 1111);
|
||||
//rsUdpStack *mUdpProxyStack = new rsUdpStack(sndladdr);
|
||||
|
||||
// FIRSTLY THE PROXY STUNNER.
|
||||
//UdpStunner *mProxyStunner = new UdpStunner(mUdpProxyStack);
|
||||
// USE DEFAULT PERIOD... mDhtStunner->setTargetStunPeriod(300); /* slow (5mins) */
|
||||
//mUdpStack->addReceiver(mDhtStunner);
|
||||
|
||||
|
||||
// FINALLY THE PROXY UDP CONNECTIONS
|
||||
//udpReceivers[1] = new UdpPeerReceiver(mUdpProxyStack); /* PROXY Connections (Alt UDP Port) */
|
||||
//udpTypes[1] = TOU_RECEIVER_TYPE_UDPPEER;
|
||||
//mUdpProxyStack->addReceiver(udpReceivers[1]);
|
||||
|
||||
|
||||
// NOW WE CAN PASS THE RECEIVERS TO TOU.
|
||||
// temp initialisation of only the DIRECT TOU.
|
||||
tou_init((void **) udpReceivers, udpTypes, 1);
|
||||
|
||||
// REAL INITIALISATION - WITH THREE MODES - FOR LATER.
|
||||
//tou_init((void **) udpReceivers, udpTypes, 3);
|
||||
|
||||
/* construct the rest of the stack */
|
||||
tou_init(mUdpStack);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue