Changeset 44429 in vbox
- Timestamp:
- Jan 28, 2013 3:16:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/socket.cpp
r43363 r44429 111 111 /** How many pending connection. */ 112 112 #define RTTCP_SERVER_BACKLOG 10 113 114 /* Limit read and write sizes on Windows and OS/2. */ 115 #ifdef RT_OS_WINDOWS 116 # define RTSOCKET_MAX_WRITE (INT_MAX / 2) 117 # define RTSOCKET_MAX_READ (INT_MAX / 2) 118 #elif defined(RT_OS_OS2) 119 # define RTSOCKET_MAX_WRITE 0x10000 120 # define RTSOCKET_MAX_READ 0x10000 121 #endif 113 122 114 123 … … 855 864 { 856 865 rtSocketErrorReset(); 857 #ifdef RT _OS_WINDOWS858 int cbNow = cbToRead >= INT_MAX/2 ? INT_MAX/2: (int)cbToRead;866 #ifdef RTSOCKET_MAX_READ 867 int cbNow = cbToRead >= RTSOCKET_MAX_READ ? RTSOCKET_MAX_READ : (int)cbToRead; 859 868 #else 860 869 size_t cbNow = cbToRead; … … 922 931 rtSocketErrorReset(); 923 932 RTSOCKADDRUNION u; 924 #ifdef RT _OS_WINDOWS925 int cbNow = cbToRead >= INT_MAX/2 ? INT_MAX/2: (int)cbToRead;933 #ifdef RTSOCKET_MAX_READ 934 int cbNow = cbToRead >= RTSOCKET_MAX_READ ? RTSOCKET_MAX_READ : (int)cbToRead; 926 935 int cbAddr = sizeof(u); 927 936 #else … … 969 978 * Try write all at once. 970 979 */ 971 #ifdef RT _OS_WINDOWS972 int cbNow = cbBuffer >= INT_MAX / 2 ? INT_MAX / 2: (int)cbBuffer;980 #ifdef RTSOCKET_MAX_WRITE 981 int cbNow = cbBuffer >= RTSOCKET_MAX_WRITE ? RTSOCKET_MAX_WRITE : (int)cbBuffer; 973 982 #else 974 983 size_t cbNow = cbBuffer >= SSIZE_MAX ? SSIZE_MAX : cbBuffer; … … 996 1005 997 1006 /* send */ 998 #ifdef RT _OS_WINDOWS999 cbNow = cbBuffer >= INT_MAX / 2 ? INT_MAX / 2: (int)cbBuffer;1007 #ifdef RTSOCKET_MAX_WRITE 1008 cbNow = cbBuffer >= RTSOCKET_MAX_WRITE ? RTSOCKET_MAX_WRITE : (int)cbBuffer; 1000 1009 #else 1001 1010 cbNow = cbBuffer >= SSIZE_MAX ? SSIZE_MAX : cbBuffer; … … 1058 1067 */ 1059 1068 #ifdef RT_OS_WINDOWS 1060 int cbNow = cbBuffer >= INT_MAX / 2 ? INT_MAX / 2: (int)cbBuffer;1069 int cbNow = cbBuffer >= RTSOCKET_MAX_WRITE ? RTSOCKET_MAX_WRITE : (int)cbBuffer; 1061 1070 #else 1062 1071 size_t cbNow = cbBuffer >= SSIZE_MAX ? SSIZE_MAX : cbBuffer; … … 1203 1212 1204 1213 rtSocketErrorReset(); 1205 #ifdef RT_OS_WINDOWS 1206 int cbNow = cbBuffer >= INT_MAX/2 ? INT_MAX/2 : (int)cbBuffer; 1207 1214 #ifdef RTSOCKET_MAX_READ 1215 int cbNow = cbBuffer >= RTSOCKET_MAX_WRITE ? RTSOCKET_MAX_WRITE : (int)cbBuffer; 1216 #else 1217 size_t cbNow = cbBuffer; 1218 #endif 1219 1220 #ifdef RT_OS_WINDOWS 1208 1221 int cbRead = recv(pThis->hNative, (char *)pvBuffer, cbNow, MSG_NOSIGNAL); 1209 1222 if (cbRead >= 0) … … 1218 1231 rc = VINF_TRY_AGAIN; 1219 1232 #else 1220 ssize_t cbRead = recv(pThis->hNative, pvBuffer, cb Buffer, MSG_NOSIGNAL);1233 ssize_t cbRead = recv(pThis->hNative, pvBuffer, cbNow, MSG_NOSIGNAL); 1221 1234 if (cbRead >= 0) 1222 1235 *pcbRead = cbRead; … … 1251 1264 1252 1265 rtSocketErrorReset(); 1253 #ifdef RT_OS_WINDOWS 1254 int cbNow = RT_MIN((int)cbBuffer, INT_MAX/2); 1255 1266 #ifdef RTSOCKET_MAX_WRITE 1267 int cbNow = cbBuffer >= RTSOCKET_MAX_WRITE ? RTSOCKET_MAX_WRITE : (int)cbBuffer; 1268 #else 1269 size_t cbNow = cbBuffer; 1270 #endif 1271 1272 #ifdef RT_OS_WINDOWS 1256 1273 int cbWritten = send(pThis->hNative, (const char *)pvBuffer, cbNow, MSG_NOSIGNAL); 1257 1258 1274 if (cbWritten >= 0) 1259 1275 {
Note:
See TracChangeset
for help on using the changeset viewer.