Changeset 14188 in vbox for trunk/src/VBox
- Timestamp:
- Nov 13, 2008 5:12:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/slirp.c
r14183 r14188 200 200 { 201 201 int fNATfailed = 0; 202 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)203 int i;204 #endif205 202 PNATState pData = malloc(sizeof(NATState)); 206 203 *ppData = pData; … … 225 222 WSAStartup(MAKEWORD(2,0), &Data); 226 223 } 227 #if def VBOX_WITH_SIMPLEFIED_SLIRP_SYNC224 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 228 225 pData->phEvents[VBOX_SOCKET_EVENT_INDEX] = CreateEvent(NULL, FALSE, FALSE, NULL); 229 226 #endif … … 358 355 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 359 356 int rc; 360 /* Number of valid entries. 361 * 1st event for drvNATSend() */ 362 int cElements; 357 int error; 363 358 #endif 364 359 … … 376 371 ((struct ipasfrag *)&ipq != u32_to_ptr(pData, ipq.next, struct ipasfrag *))); 377 372 378 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)379 /*380 * Make this array static with a fixed maximum381 * 1st event for drvNATSend()382 */383 cElements = 1;384 #endif385 386 373 for (so = tcb.so_next; so != &tcb; so = so_next) { 387 374 so_next = so->so_next; … … 409 396 #else 410 397 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_OOB); 411 AssertRelease(rc != SOCKET_ERROR); 398 if (rc == SOCKET_ERROR) 399 { 400 socket_error: 401 error = WSAGetLastError(); 402 LogRel(("WSAEventSelector error %d (so=%x, socket=%s, event=%x)\n", error, so, so->s, VBOX_SOCKET_EVENT)); 403 } 412 404 #endif 413 405 continue; … … 423 415 #else 424 416 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_OOB); 425 AssertRelease(rc != SOCKET_ERROR); 417 if (rc == SOCKET_ERROR) 418 goto socket_error; 426 419 #endif 427 420 continue; … … 438 431 #else 439 432 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_OOB); 440 AssertRelease(rc != SOCKET_ERROR); 433 if (rc == SOCKET_ERROR) 434 goto socket_error; 441 435 continue; /*XXX: we're using the widest mask for event*/ 442 436 #endif … … 454 448 #else 455 449 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_OOB|FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT); 456 AssertRelease(rc != SOCKET_ERROR); 450 if (rc == SOCKET_ERROR) 451 goto socket_error; 457 452 continue; /*XXX: we're using the widest mask for event*/ 458 453 #endif 459 454 } 460 455 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 461 WSAEventSelect(so->s, NULL, 0); 456 rc = WSAEventSelect(so->s, NULL, 0); 457 if (rc == SOCKET_ERROR) 458 goto socket_error; 462 459 #endif 463 460 } … … 496 493 #else 497 494 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT); 498 AssertRelease(rc != SOCKET_ERROR); 495 if (rc == SOCKET_ERROR) 496 goto socket_error; 499 497 continue; 500 498 #endif 501 499 } 502 500 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 503 WSAEventSelect(so->s, NULL, 0); 501 else 502 { 503 rc = WSAEventSelect(so->s, NULL, 0); 504 if (rc != SOCKET_ERROR) 505 goto socket_error; 506 } 504 507 #endif 505 508 } … … 551 554 int ret; 552 555 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 553 WSANETWORKEVENTS NetworkEvents; 556 WSANETWORKEVENTS NetworkEvents; 554 557 int rc; 558 int error; 555 559 int timer_update = (readfds == NULL && writefds == NULL && xfds == NULL); 556 560 #endif … … 595 599 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 596 600 rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents); 597 AssertRelease(rc != SOCKET_ERROR); 601 if (rc == SOCKET_ERROR) 602 { 603 error = WSAGetLastError(); 604 LogRel(("WSAEnumNetworkEvents TCP error %d\n", error)); 605 continue; 606 } 598 607 #endif 599 608 … … 730 739 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 731 740 rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents); 732 AssertRelease(rc != SOCKET_ERROR); 741 if (rc == SOCKET_ERROR) 742 { 743 error = WSAGetLastError(); 744 LogRel(("WSAEnumNetworkEvents TCP error %d\n", error)); 745 continue; 746 } 733 747 #endif 734 748 #if !defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) … … 919 933 HANDLE *slirp_get_events(PNATState pData) 920 934 { 921 return (pData->phEvents);935 return pData->phEvents; 922 936 } 923 937 void slirp_register_external_event(PNATState pData, HANDLE hEvent)
Note:
See TracChangeset
for help on using the changeset viewer.