X-Git-Url: http://git.meshlink.io/?p=utcp;a=blobdiff_plain;f=utcp.c;h=02d3c983ba75d3ad1dc9ea1447ebaa64588bf9b5;hp=bfd9921f56a23e24c25078e7b73d53768456ca88;hb=0f36bb393e49ecab387b1bfe88741a337d4a8834;hpb=d1b2b2dc5997c6818e24bd45b916d8b06c13b892 diff --git a/utcp.c b/utcp.c index bfd9921..02d3c98 100644 --- a/utcp.c +++ b/utcp.c @@ -1512,6 +1512,22 @@ void utcp_set_mtu(struct utcp *utcp, uint16_t mtu) { utcp->mtu = mtu; } +void utcp_reset_timers(struct utcp *utcp) { + if(!utcp) + return; + struct timeval now, then; + gettimeofday(&now, NULL); + then = now; + then.tv_sec += utcp->timeout; + for(int i = 0; i < utcp->nconnections; i++) { + utcp->connections[i]->rtrx_timeout = now; + utcp->connections[i]->conn_timeout = then; + utcp->connections[i]->rtt_start.tv_sec = 0; + } + if(utcp->rto > START_RTO) + utcp->rto = START_RTO; +} + int utcp_get_user_timeout(struct utcp *u) { return u ? u->timeout : 0; }