aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/tcp.c
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2010-09-02 03:34:04 +0100
committerMichael Brown <mcb30@ipxe.org>2010-09-03 21:28:43 +0100
commit28934eef81b3c7a494b12cb87804098041d64659 (patch)
treeda46f478f9977bca4c06f5e71dc37a0066948237 /src/net/tcp.c
parent25447294d551bb93f63dd7e43e19b65e7c89e4db (diff)
downloadipxe-28934eef81b3c7a494b12cb87804098041d64659.tar.gz
[retry] Hold reference while timer is running and during expiry callback
Guarantee that a retry timer cannot go out of scope while the timer is running, and provide a guarantee to the expiry callback that the timer will remain in scope during the entire callback (similar to the guarantee provided to interface methods). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tcp.c')
-rw-r--r--src/net/tcp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c
index b2d88273..1c824bdf 100644
--- a/src/net/tcp.c
+++ b/src/net/tcp.c
@@ -265,8 +265,8 @@ static int tcp_open ( struct interface *xfer, struct sockaddr *peer,
DBGC ( tcp, "TCP %p allocated\n", tcp );
ref_init ( &tcp->refcnt, NULL );
intf_init ( &tcp->xfer, &tcp_xfer_desc, &tcp->refcnt );
- timer_init ( &tcp->timer, tcp_expired );
- timer_init ( &tcp->wait, tcp_wait_expired );
+ timer_init ( &tcp->timer, tcp_expired, &tcp->refcnt );
+ timer_init ( &tcp->wait, tcp_wait_expired, &tcp->refcnt );
tcp->prev_tcp_state = TCP_CLOSED;
tcp->tcp_state = TCP_STATE_SENT ( TCP_SYN );
tcp_dump_state ( tcp );