mirror of
https://github.com/transmission/transmission
synced 2025-03-19 10:15:36 +00:00
Check for UTP timeouts every 50ms or so.
Greg says that works for them.
This commit is contained in:
parent
7741151c48
commit
87d1f5ca34
1 changed files with 8 additions and 2 deletions
|
@ -34,6 +34,10 @@ THE SOFTWARE.
|
||||||
#include "peer-mgr.h"
|
#include "peer-mgr.h"
|
||||||
#include "tr-utp.h"
|
#include "tr-utp.h"
|
||||||
|
|
||||||
|
/* Greg says 50ms works for them. */
|
||||||
|
|
||||||
|
#define UTP_INTERVAL_US 50000
|
||||||
|
|
||||||
static struct event *utp_timer = NULL;
|
static struct event *utp_timer = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -82,7 +86,8 @@ static void
|
||||||
timer_callback(int s UNUSED, short type UNUSED, void *closure UNUSED)
|
timer_callback(int s UNUSED, short type UNUSED, void *closure UNUSED)
|
||||||
{
|
{
|
||||||
UTP_CheckTimeouts();
|
UTP_CheckTimeouts();
|
||||||
tr_timerAdd(utp_timer, 1, tr_cryptoWeakRandInt(1000000));
|
tr_timerAdd(utp_timer, 0,
|
||||||
|
UTP_INTERVAL_US / 2 + tr_cryptoWeakRandInt(UTP_INTERVAL_US));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -95,7 +100,8 @@ tr_utpPacket(const unsigned char *buf, size_t buflen,
|
||||||
if(utp_timer == NULL)
|
if(utp_timer == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
evtimer_set(utp_timer, timer_callback, NULL);
|
evtimer_set(utp_timer, timer_callback, NULL);
|
||||||
tr_timerAdd(utp_timer, 1, tr_cryptoWeakRandInt(1000000));
|
tr_timerAdd(utp_timer, 0,
|
||||||
|
UTP_INTERVAL_US / 2 + tr_cryptoWeakRandInt(UTP_INTERVAL_US));
|
||||||
}
|
}
|
||||||
|
|
||||||
return UTP_IsIncomingUTP(incoming, send_to, ss,
|
return UTP_IsIncomingUTP(incoming, send_to, ss,
|
||||||
|
|
Loading…
Add table
Reference in a new issue