From 8828d269af4605eccf8fc2000c1777265c0f58ef Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 12 Jan 2012 02:11:02 +0000 Subject: [PATCH] [DHCPCSVC] - Remove timeouts associated with the protocol in remove_protocol() svn path=/branches/wlan-bringup/; revision=54915 --- dll/win32/dhcpcsvc/dhcp/dispatch.c | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/dll/win32/dhcpcsvc/dhcp/dispatch.c b/dll/win32/dhcpcsvc/dhcp/dispatch.c index 013ef14b4af..cde5cad2b82 100644 --- a/dll/win32/dhcpcsvc/dhcp/dispatch.c +++ b/dll/win32/dhcpcsvc/dhcp/dispatch.c @@ -352,6 +352,43 @@ void remove_protocol(struct protocol *proto) { struct protocol *p, *next, *prev; + struct interface_info *ip = proto->local; + struct timeout *t, *q, *u; + + t = NULL; + q = timeouts; + while (q != NULL) + { + /* Remove all timeouts for this protocol */ + if (q->what == ip) + { + /* Unlink the timeout from previous */ + if (t) + t->next = q->next; + else + timeouts = q->next; + + DbgPrint("Disposing timeout 0x%x\n", q); + + /* Advance to the next timeout */ + u = q->next; + + /* Add it to the free list */ + q->next = free_timeouts; + free_timeouts = q; + } + else + { + /* Advance to the next timeout */ + u = q->next; + + /* Update the previous pointer */ + t = q; + } + + /* Advance */ + q = u; + } prev = NULL; for (p = protocols; p; p = next) {