mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
This is a little experimental modification to the TCP/UDP listening ports.
* Modified bind calls to attach to 0.0.0.0:XXXX instead of specific IP:Port combinations. This will help connectivity when RS chooses the wrong interface. * These changes are within #defines so they can be easily reverted. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1498 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c14572b13e
commit
6e5d2f43d8
2 changed files with 32 additions and 0 deletions
|
@ -52,6 +52,17 @@
|
|||
|
||||
static const int UDP_DEF_TTL = 64;
|
||||
|
||||
/* NB: This #define makes the listener open 0.0.0.0:X port instead
|
||||
* of a specific port - this might help retroshare work on PCs with
|
||||
* multiple interfaces or unique network setups.
|
||||
* #define OPEN_UNIVERSAL_PORT 1
|
||||
*
|
||||
* This is also defined in pqissllistener (for TCP port).
|
||||
*/
|
||||
|
||||
#define OPEN_UNIVERSAL_PORT 1
|
||||
|
||||
|
||||
class udpPacket
|
||||
{
|
||||
public:
|
||||
|
@ -319,7 +330,15 @@ int UdpLayer::openSocket()
|
|||
std::cerr << "UpdStreamer::openSocket()" << std::endl;
|
||||
#endif
|
||||
/* bind to address */
|
||||
|
||||
|
||||
#ifdef OPEN_UNIVERSAL_PORT
|
||||
struct sockaddr_in tmpaddr = laddr;
|
||||
tmpaddr.sin_addr.s_addr = 0;
|
||||
if (0 != tounet_bind(sockfd, (struct sockaddr *) (&tmpaddr), sizeof(tmpaddr)))
|
||||
#else
|
||||
if (0 != tounet_bind(sockfd, (struct sockaddr *) (&laddr), sizeof(laddr)))
|
||||
#endif
|
||||
{
|
||||
#ifdef DEBUG_UDP_LAYER
|
||||
std::cerr << "Socket Failed to Bind to : " << laddr << std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue