Changeset 49443 in vbox for trunk/src/VBox
- Timestamp:
- Nov 12, 2013 4:14:02 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NAT/pxdns.c
r49299 r49443 94 94 #define TIMEOUT 5 95 95 size_t timeout_slot; 96 u32_t timeout_mask; 96 97 struct request *timeout_list[TIMEOUT]; 97 98 … … 143 144 struct request **pprev_timeout; 144 145 struct request *next_timeout; 146 147 /** 148 * Slot in pxdns::timeout_list 149 */ 150 size_t timeout_slot; 145 151 146 152 /** … … 252 258 253 259 pxdns->timeout_slot = 0; 260 pxdns->timeout_mask = 0; 254 261 255 262 /* NB: assumes pollmgr thread is not running yet */ … … 258 265 pollmgr_add(&pxdns->pmhdl6, pxdns->sock6, POLLIN); 259 266 } 260 261 sys_timeout(1 * 1000, pxdns_timer, pxdns);262 267 263 268 return ERR_OK; … … 418 423 { 419 424 struct request **chain; 425 u32_t omask; 420 426 421 427 LWIP_ASSERT1(req->pprev_timeout == NULL); 422 chain = &pxdns->timeout_list[pxdns->timeout_slot]; 428 429 req->timeout_slot = pxdns->timeout_slot; 430 chain = &pxdns->timeout_list[req->timeout_slot]; 423 431 if ((req->next_timeout = *chain) != NULL) { 424 432 (*chain)->pprev_timeout = &req->next_timeout; … … 426 434 *chain = req; 427 435 req->pprev_timeout = chain; 436 437 omask = pxdns->timeout_mask; 438 pxdns->timeout_mask |= 1U << req->timeout_slot; 439 if (omask == 0) { 440 sys_timeout(1 * 1000, pxdns_timer, pxdns); 441 } 428 442 } 429 443 … … 448 462 { 449 463 LWIP_ASSERT1(req->pprev_timeout != NULL); 464 LWIP_ASSERT1(req->timeout_slot < TIMEOUT); 450 465 451 466 if (req->next_timeout != NULL) { … … 455 470 req->pprev_timeout = NULL; 456 471 req->next_timeout = NULL; 472 473 if (pxdns->timeout_list[req->timeout_slot] == NULL) { 474 pxdns->timeout_mask &= ~(1U << req->timeout_slot); 475 /* may be on pollmgr thread so no sys_untimeout */ 476 } 457 477 } 458 478 … … 526 546 struct pxdns *pxdns = (struct pxdns *)arg; 527 547 struct request **chain, *req; 548 u32_t mask; 528 549 529 550 sys_mutex_lock(&pxdns->lock); … … 557 578 } 558 579 580 if (pxdns->timeout_list[pxdns->timeout_slot] == NULL) { 581 pxdns->timeout_mask &= ~(1U << pxdns->timeout_slot); 582 } 583 else { 584 pxdns->timeout_mask |= 1U << pxdns->timeout_slot; 585 } 586 mask = pxdns->timeout_mask; 587 559 588 sys_mutex_unlock(&pxdns->lock); 560 589 561 sys_timeout(1 * 1000, pxdns_timer, pxdns); 590 if (mask != 0) { 591 sys_timeout(1 * 1000, pxdns_timer, pxdns); 592 } 562 593 } 563 594
Note:
See TracChangeset
for help on using the changeset viewer.