[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
+4 -2
View File
@@ -695,8 +695,10 @@ static int slam_open ( struct interface *xfer, struct uri *uri ) {
intf_init ( &slam->xfer, &slam_xfer_desc, &slam->refcnt );
intf_init ( &slam->socket, &slam_socket_desc, &slam->refcnt );
intf_init ( &slam->mc_socket, &slam_mc_socket_desc, &slam->refcnt );
timer_init ( &slam->master_timer, slam_master_timer_expired );
timer_init ( &slam->slave_timer, slam_slave_timer_expired );
timer_init ( &slam->master_timer, slam_master_timer_expired,
&slam->refcnt );
timer_init ( &slam->slave_timer, slam_slave_timer_expired,
&slam->refcnt );
/* Fake an invalid cached header of { 0x00, ... } */
slam->header_len = 1;
/* Fake parameters for initial NACK */