Fossil SCM
Fix the socket_receive() function so that it compiles on systems that lack the MSG_DONTWAIT macro (Windows). Such systems lose non-blocking capabilities, but they work otherwise.
Commit
31d274d02ea8944c6e2400228a8dba9366baed2fe12c30af1a36fdda8cf277e5
Parent
aa80d6941e8e9a5…
1 file changed
+4
-1
+4
-1
| --- src/http_socket.c | ||
| +++ src/http_socket.c | ||
| @@ -215,11 +215,14 @@ | ||
| 215 | 215 | ** have been read. |
| 216 | 216 | */ |
| 217 | 217 | size_t socket_receive(void *NotUsed, void *pContent, size_t N, int bDontBlock){ |
| 218 | 218 | ssize_t got; |
| 219 | 219 | size_t total = 0; |
| 220 | - int flags = bDontBlock ? MSG_DONTWAIT : 0; | |
| 220 | + int flags = 0; | |
| 221 | +#ifdef MSG_DONTWAIT | |
| 222 | + if( bDontBlock ) flags |= MSG_DONTWAIT; | |
| 223 | +#endif | |
| 221 | 224 | while( N>0 ){ |
| 222 | 225 | /* WinXP fails for large values of N. So limit it to 64KiB. */ |
| 223 | 226 | got = recv(iSocket, pContent, N>65536 ? 65536 : N, flags); |
| 224 | 227 | if( got<=0 ) break; |
| 225 | 228 | total += (size_t)got; |
| 226 | 229 |
| --- src/http_socket.c | |
| +++ src/http_socket.c | |
| @@ -215,11 +215,14 @@ | |
| 215 | ** have been read. |
| 216 | */ |
| 217 | size_t socket_receive(void *NotUsed, void *pContent, size_t N, int bDontBlock){ |
| 218 | ssize_t got; |
| 219 | size_t total = 0; |
| 220 | int flags = bDontBlock ? MSG_DONTWAIT : 0; |
| 221 | while( N>0 ){ |
| 222 | /* WinXP fails for large values of N. So limit it to 64KiB. */ |
| 223 | got = recv(iSocket, pContent, N>65536 ? 65536 : N, flags); |
| 224 | if( got<=0 ) break; |
| 225 | total += (size_t)got; |
| 226 |
| --- src/http_socket.c | |
| +++ src/http_socket.c | |
| @@ -215,11 +215,14 @@ | |
| 215 | ** have been read. |
| 216 | */ |
| 217 | size_t socket_receive(void *NotUsed, void *pContent, size_t N, int bDontBlock){ |
| 218 | ssize_t got; |
| 219 | size_t total = 0; |
| 220 | int flags = 0; |
| 221 | #ifdef MSG_DONTWAIT |
| 222 | if( bDontBlock ) flags |= MSG_DONTWAIT; |
| 223 | #endif |
| 224 | while( N>0 ){ |
| 225 | /* WinXP fails for large values of N. So limit it to 64KiB. */ |
| 226 | got = recv(iSocket, pContent, N>65536 ? 65536 : N, flags); |
| 227 | if( got<=0 ) break; |
| 228 | total += (size_t)got; |
| 229 |