[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
@@ -527,7 +527,7 @@ static int dns_resolv ( struct interface *resolv,
ref_init ( &dns->refcnt, NULL );
intf_init ( &dns->resolv, &dns_resolv_desc, &dns->refcnt );
intf_init ( &dns->socket, &dns_socket_desc, &dns->refcnt );
timer_init ( &dns->timer, dns_timer_expired );
timer_init ( &dns->timer, dns_timer_expired, &dns->refcnt );
memcpy ( &dns->sa, sa, sizeof ( dns->sa ) );
/* Create query */