Changeset 14159 in vbox
- Timestamp:
- Nov 13, 2008 6:30:22 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/slirp.c
r14129 r14159 200 200 { 201 201 int fNATfailed = 0; 202 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 203 int i; 204 #endif 202 205 PNATState pData = malloc(sizeof(NATState)); 203 206 *ppData = pData; … … 224 227 #ifdef VBOX_WITH_SIMPLEFIED_SLIRP_SYNC 225 228 /*XXX:probably should be configurable*/ 226 pData->cMaxEvent = 256;229 pData->cMaxEvent = WSA_MAXIMUM_WAIT_EVENTS; 227 230 pData->phEvents = malloc(sizeof(HANDLE) * pData->cMaxEvent); 231 for (i = 1; i < WSA_MAXIMUM_WAIT_EVENTS; ++i) { 232 pData->phEvents[i] = CreateEvent(NULL, FALSE, FALSE, NULL); 233 } 228 234 #endif 229 235 #endif … … 402 408 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 403 409 AssertRelease(cEvents < pData->cMaxEvent); 404 WSAResetEvent(so->hNetworkEvent);405 410 #endif 406 411 /* … … 504 509 UPD_NFDS(so->s); 505 510 #else 506 WSAResetEvent(so->hNetworkEvent);507 511 AssertRelease(cEvents < pData->cMaxEvent); 508 512 rc = WSAEventSelect(so->s, so->hNetworkEvent, FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT); … … 631 635 if (so->so_state & SS_FACCEPTCONN) { 632 636 tcp_connect(pData, so); 633 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)634 WSAResetEvent(so->hNetworkEvent);635 #endif636 637 continue; 637 638 } /* else */ … … 670 671 if (errno == EAGAIN || errno == EWOULDBLOCK || 671 672 errno == EINPROGRESS || errno == ENOTCONN) { 672 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)673 WSAResetEvent(so->hNetworkEvent);674 #endif675 673 continue; 676 674 } … … 709 707 if (errno == EAGAIN || errno == EWOULDBLOCK || 710 708 errno == EINPROGRESS || errno == ENOTCONN) { 711 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)712 WSAResetEvent(so->hNetworkEvent);713 #endif714 709 continue; /* Still connecting, continue */ 715 710 } … … 725 720 if (errno == EAGAIN || errno == EWOULDBLOCK || 726 721 errno == EINPROGRESS || errno == ENOTCONN) { 727 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)728 WSAResetEvent(so->hNetworkEvent);729 #endif730 722 continue; 731 723 } … … 759 751 #endif 760 752 sorecvfrom(pData, so); 761 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)762 WSAResetEvent(so->hNetworkEvent);763 #endif764 753 } 765 754 } -
trunk/src/VBox/Devices/Network/slirp/socket.c
r14085 r14159 60 60 so->so_state = SS_NOFDREF; 61 61 so->s = -1; 62 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)63 so->hNetworkEvent = WSACreateEvent(); /*XXX: NOT correct place*/64 AssertRelease(so->hNetworkEvent != WSA_INVALID_EVENT);65 #endif66 62 } 67 63 return(so); … … 740 736 } 741 737 738 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 739 void soregister_event(struct NATState *pData, struct socket *so) 740 { 741 static int soidx; 742 static int eidx = 1; 743 744 if (soidx >= WSA_MAXIMUM_WAIT_EVENTS * eidx) { 745 eidx++; 746 } 747 so->hNetworkEvent = pData->phEvents[eidx]; 748 soidx++; 749 } 750 #endif -
trunk/src/VBox/Devices/Network/slirp/socket.h
r14028 r14159 104 104 void soisfdisconnected _P((struct socket *)); 105 105 void sofwdrain _P((struct socket *)); 106 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 107 void soregister_event _P((PNATState, struct socket *)); 108 #endif 106 109 107 110 #endif /* _SOCKET_H_ */ -
trunk/src/VBox/Devices/Network/slirp/tcp_input.c
r13984 r14159 391 391 goto dropwithreset; 392 392 } 393 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 394 soregister_event(pData, so); 395 #endif 393 396 394 397 sbreserve(&so->so_snd, tcp_sndspace); -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r13984 r14159 466 466 return; 467 467 } 468 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 469 soregister_event(pData, so); 470 #endif 468 471 so->so_laddr = inso->so_laddr; 469 472 so->so_lport = inso->so_lport; -
trunk/src/VBox/Devices/Network/slirp/udp.c
r13984 r14159 636 636 return NULL; 637 637 } 638 #if defined(VBOX_WITH_SIMPLEFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 639 soregister_event(pData, so); 640 #endif 638 641 so->s = socket(AF_INET,SOCK_DGRAM,0); 639 642 so->so_expire = curtime + SO_EXPIRE;
Note:
See TracChangeset
for help on using the changeset viewer.