mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 23:36:59 -05:00
* Increased the max size of the relay packet to match tcpstream packet sizes.
* Added More debugging. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4765 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
88774bbbd3
commit
9da96aef97
@ -42,7 +42,11 @@ int displayUdpRelayPacketHeader(const void *data, const int size);
|
|||||||
|
|
||||||
/****************** UDP RELAY STUFF **********/
|
/****************** UDP RELAY STUFF **********/
|
||||||
|
|
||||||
#define MAX_RELAY_UDP_PACKET_SIZE 1024
|
// This packet size must be able to handle TcpStream Packets.
|
||||||
|
// At the moment, they can be 1000 + 20 for TcpOnUdp ... + 16 => 1036 minimal size.
|
||||||
|
// See Notes in tcpstream.h for more info
|
||||||
|
#define MAX_RELAY_UDP_PACKET_SIZE (1400 + 20 + 16)
|
||||||
|
|
||||||
|
|
||||||
UdpRelayReceiver::UdpRelayReceiver(UdpPublisher *pub)
|
UdpRelayReceiver::UdpRelayReceiver(UdpPublisher *pub)
|
||||||
:UdpSubReceiver(pub), udppeerMtx("UdpSubReceiver"), relayMtx("UdpSubReceiver")
|
:UdpSubReceiver(pub), udppeerMtx("UdpSubReceiver"), relayMtx("UdpSubReceiver")
|
||||||
@ -91,12 +95,13 @@ int UdpRelayReceiver::addUdpPeer(UdpPeer *peer, UdpRelayAddrSet *endPoints,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_UDP_RELAY
|
|
||||||
std::cerr << "UdpRelayReceiver::addUdpPeer() Installing UdpRelayEnd (mapping)" << std::endl;
|
|
||||||
#endif
|
|
||||||
/* setup a peer */
|
/* setup a peer */
|
||||||
UdpRelayEnd ure(endPoints, proxyaddr);
|
UdpRelayEnd ure(endPoints, proxyaddr);
|
||||||
|
|
||||||
|
#ifdef DEBUG_UDP_RELAY
|
||||||
|
std::cerr << "UdpRelayReceiver::addUdpPeer() Installing UdpRelayEnd: " << ure << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
mStreams[realPeerAddr] = ure;
|
mStreams[realPeerAddr] = ure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,6 +115,7 @@ int UdpRelayReceiver::addUdpPeer(UdpPeer *peer, UdpRelayAddrSet *endPoints,
|
|||||||
|
|
||||||
/* just overwrite */
|
/* just overwrite */
|
||||||
mPeers[realPeerAddr] = peer;
|
mPeers[realPeerAddr] = peer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -717,6 +723,10 @@ int UdpRelayReceiver::sendPkt(const void *data, int size, const struct sockaddr_
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_UDP_RELAY
|
||||||
|
std::cerr << "UdpRelayReceiver::sendPkt() to Relay: " << it->second;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
/* add a header to packet */
|
/* add a header to packet */
|
||||||
int finalPktSize = createRelayUdpPacket(data, size, mTmpSendPkt, MAX_RELAY_UDP_PACKET_SIZE, &(it->second));
|
int finalPktSize = createRelayUdpPacket(data, size, mTmpSendPkt, MAX_RELAY_UDP_PACKET_SIZE, &(it->second));
|
||||||
|
|
||||||
@ -777,6 +787,7 @@ int displayUdpRelayPacketHeader(const void *data, const int size)
|
|||||||
std::cerr << out.str();
|
std::cerr << out.str();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -822,6 +833,9 @@ int createRelayUdpPacket(const void *data, const int size, void *newpkt, int new
|
|||||||
{
|
{
|
||||||
std::cerr << "createRelayUdpPacket() ERROR invalid size";
|
std::cerr << "createRelayUdpPacket() ERROR invalid size";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "Incoming DataSize: " << size << " + Header: " << UDP_RELAY_HEADER_SIZE;
|
||||||
|
std::cerr << " > " << newsize;
|
||||||
|
std::cerr << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint8_t *header = (uint8_t *) newpkt;
|
uint8_t *header = (uint8_t *) newpkt;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user