mirror of
https://github.com/transmission/transmission
synced 2025-03-19 02:05:32 +00:00
Push testig for UTP enabled further down.
There's no need to test for DHT/uTP being enabled in tr-udp. The DHT will silently discard any packets directed at the wrong session (see the beginning of dhtCallback). As to uTP, we need to grok uTP packets to close any remaining connections after we disabled uTP, so it's better to participate in uTP, just reject any incoming connections.
This commit is contained in:
parent
4f50c5dda4
commit
51bc8d8b80
2 changed files with 7 additions and 2 deletions
|
@ -135,11 +135,11 @@ event_callback(int s, short type UNUSED, void *sv)
|
|||
if(rc <= 0)
|
||||
return;
|
||||
|
||||
if((buf[0] == 'd') && tr_sessionIsDHTEnabled(ss)) {
|
||||
if( buf[0] == 'd' ) {
|
||||
/* DHT packet. */
|
||||
buf[rc] = '\0';
|
||||
tr_dhtCallback(buf, rc, (struct sockaddr*)&from, fromlen, sv);
|
||||
} else if(tr_sessionIsUTPEnabled(ss)){
|
||||
} else {
|
||||
rc = tr_utpPacket(buf, rc, (struct sockaddr*)&from, fromlen, ss);
|
||||
if(!rc)
|
||||
tr_ndbg("UDP", "Unexpected UDP packet");
|
||||
|
|
|
@ -49,6 +49,11 @@ incoming(void *closure, struct UTPSocket *s)
|
|||
socklen_t fromlen = sizeof(from_storage);
|
||||
tr_address addr;
|
||||
tr_port port;
|
||||
|
||||
if( !tr_sessionIsUTPEnabled(ss) ) {
|
||||
UTP_Close(s);
|
||||
return;
|
||||
}
|
||||
|
||||
UTP_GetPeerName(s, from, &fromlen);
|
||||
if(from->sa_family == AF_INET) {
|
||||
|
|
Loading…
Add table
Reference in a new issue