The function utcp_reset_timers() will reset the retransmit timers of all
connections to zero, so they will fire immediately. The connection timeout will
be reset to the user timeout value, and if the RTO is larger than the
starting RTO, it will be set to the starting RTO.
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;
}
extern uint16_t utcp_get_mtu(struct utcp *utcp);
extern void utcp_set_mtu(struct utcp *utcp, uint16_t mtu);
+extern void utcp_reset_timers(struct utcp *utcp);
+
// Per-socket options
extern size_t utcp_get_sndbuf(struct utcp_connection *connection);