[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>
This commit is contained in:
Michael Brown
2010-09-03 21:28:43 +01:00
parent 25447294d5
commit 28934eef81
10 changed files with 31 additions and 14 deletions
+1 -1
View File
@@ -1097,7 +1097,7 @@ static int tftp_core_open ( struct interface *xfer, struct uri *uri,
intf_init ( &tftp->xfer, &tftp_xfer_desc, &tftp->refcnt );
intf_init ( &tftp->socket, &tftp_socket_desc, &tftp->refcnt );
intf_init ( &tftp->mc_socket, &tftp_mc_socket_desc, &tftp->refcnt );
timer_init ( &tftp->timer, tftp_timer_expired );
timer_init ( &tftp->timer, tftp_timer_expired, &tftp->refcnt );
tftp->uri = uri_get ( uri );
tftp->blksize = TFTP_DEFAULT_BLKSIZE;
tftp->flags = flags;