summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
cb9223d)
Start it when we are have some data to send, and reset it whenever some of
the data is ACKed. Stop the timer if the peer has received all the data.
Also ensure the poll callback is called with len = 0 when the timeout is
hit.
start_retransmit_timer(c);
}
start_retransmit_timer(c);
}
+ if(is_reliable(c) && !timerisset(&c->conn_timeout)) {
+ gettimeofday(&c->conn_timeout, NULL);
+ c->conn_timeout.tv_sec += c->utcp->timeout;
+ }
+
// 4. Update timers
if(advanced) {
// 4. Update timers
if(advanced) {
- timerclear(&c->conn_timeout); // It will be set anew in utcp_timeout() if c->snd.una != c->snd.nxt.
-
if(c->snd.una == c->snd.last) {
stop_retransmit_timer(c);
if(c->snd.una == c->snd.last) {
stop_retransmit_timer(c);
+ timerclear(&c->conn_timeout);
} else if(is_reliable(c)) {
start_retransmit_timer(c);
} else if(is_reliable(c)) {
start_retransmit_timer(c);
+ gettimeofday(&c->conn_timeout, NULL);
+ c->conn_timeout.tv_sec += utcp->timeout;
+ if(c->poll) {
+ c->poll(c, 0);
+ }
+