Changeset 27504 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Mar 18, 2010 9:06:06 PM (15 years ago)
- Location:
- trunk/src/VBox/Runtime/r3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/socket.cpp
r27503 r27504 34 34 *******************************************************************************/ 35 35 #ifdef RT_OS_WINDOWS 36 # include <winsock.h> 36 //# include <winsock.h> 37 # include <winsock2.h> 37 38 #else /* !RT_OS_WINDOWS */ 38 39 # include <errno.h> … … 74 75 # define MSG_NOSIGNAL 0 75 76 #endif 77 78 /* Windows has different names for SHUT_XXX. */ 76 79 #ifndef SHUT_RDWR 77 80 # ifdef SD_BOTH … … 88 91 # endif 89 92 #endif 93 #ifndef SHUT_RD 94 # ifdef SD_RECEIVE 95 # define SHUT_RD SD_RECEIVE 96 # else 97 # define SHUT_RD 0 98 # endif 99 #endif 90 100 91 101 /* fixup backlevel OSes. */ … … 117 127 SOCKET hNative; 118 128 /** The event semaphore we've associated with the socket handle. 119 * This is INVALID_HANDLE_VALUEif not done. */129 * This is WSA_INVALID_EVENT if not done. */ 120 130 WSAEVENT hEvent; 121 131 /** The pollset currently polling this socket. This is NIL if no one is … … 252 262 pThis->hNative = hNative; 253 263 #ifdef RT_OS_WINDOWS 254 pThis->hEvent = INVALID_HANDLE_VALUE;255 pThis->hPollSet = 0;264 pThis->hEvent = WSA_INVALID_EVENT; 265 pThis->hPollSet = NIL_RTPOLLSET; 256 266 pThis->fPollEvts = 0; 257 267 #endif … … 318 328 int rc = VINF_SUCCESS; 319 329 #ifdef RT_OS_WINDOWS 320 if (pThis->hEvent == INVALID_HANDLE_VALUE)321 { 322 CloseHandle(pThis->hEvent);323 pThis->hEvent = INVALID_HANDLE_VALUE;324 } 325 326 if (pThis->hNative != INVALID_ HANDLE_VALUE)330 if (pThis->hEvent == WSA_INVALID_EVENT) 331 { 332 WSACloseEvent(pThis->hEvent); 333 pThis->hEvent = WSA_INVALID_EVENT; 334 } 335 336 if (pThis->hNative != INVALID_SOCKET) 327 337 { 328 338 rc = closesocket(pThis->hNative); … … 334 344 AssertMsgFailed(("\"%s\": closesocket(%p) -> %Rrc\n", pThis->hNative, rc)); 335 345 } 336 pThis->hNative = INVALID_ HANDLE_VALUE;346 pThis->hNative = INVALID_SOCKET; 337 347 } 338 348 … … 371 381 int rc = VINF_SUCCESS; 372 382 #ifdef RT_OS_WINDOWS 373 if (!SetHandleInformation( pThis->hNative, HANDLE_FLAG_INHERIT, fInheritable ? HANDLE_FLAG_INHERIT : 0))383 if (!SetHandleInformation((HANDLE)pThis->hNative, HANDLE_FLAG_INHERIT, fInheritable ? HANDLE_FLAG_INHERIT : 0)) 374 384 rc = RTErrConvertFromWin32(GetLastError()); 375 385 #else -
trunk/src/VBox/Runtime/r3/tcp.cpp
r27503 r27504 34 34 *******************************************************************************/ 35 35 #ifdef RT_OS_WINDOWS 36 # include <winsock .h>36 # include <winsock2.h> 37 37 #else /* !RT_OS_WINDOWS */ 38 38 # include <errno.h> … … 103 103 * Structures and Typedefs * 104 104 *******************************************************************************/ 105 /**106 * Socket handle data.107 *108 * This is mainly required for implementing RTPollSet on Windows.109 */110 typedef struct RTSOCKETINT111 {112 /** Magic number (RTTCPSOCKET_MAGIC). */113 uint32_t u32Magic;114 /** Usage count. This is used to prevent two threads from accessing the115 * handle concurrently. */116 uint32_t volatile cUsers;117 #ifdef RT_OS_WINDOWS118 /** The native socket handle. */119 SOCKET hNative;120 /** The event semaphore we've associated with the socket handle.121 * This is INVALID_HANDLE_VALUE if not done. */122 WSAEVENT hEvent;123 /** The pollset currently polling this socket. This is NIL if no one is124 * polling. */125 RTPOLLSET hPollSet;126 /** The events we're polling for. */127 uint32_t fPollEvts;128 #else129 /** The native socket handle. */130 int hNative;131 #endif132 } RTSOCKETINT;133 134 135 /**136 * Address union used internally for things like getpeername and getsockname.137 */138 typedef union RTSOCKADDRUNION139 {140 struct sockaddr Addr;141 struct sockaddr_in Ipv4;142 #ifdef IPRT_WITH_TCPIP_V6143 struct sockaddr_in6 Ipv6;144 #endif145 } RTSOCKADDRUNION;146 147 148 149 105 /** 150 106 * TCP Server state.
Note:
See TracChangeset
for help on using the changeset viewer.