Fossil SCM
Initiate the TCP FIN on Windows before closing a socket.
Commit
ef44abc6db1682451c11a140207723980643cbf38667f4d0971a8db1ac8558ec
Parent
47ade67e2b81419…
2 files changed
+1
+4
+1
| --- src/http_socket.c | ||
| +++ src/http_socket.c | ||
| @@ -119,10 +119,11 @@ | ||
| 119 | 119 | ** is a no-op. |
| 120 | 120 | */ |
| 121 | 121 | void socket_close(void){ |
| 122 | 122 | if( iSocket>=0 ){ |
| 123 | 123 | #if defined(_WIN32) |
| 124 | + if( shutdown(iSocket,1)==0 ) shutdown(iSocket,0); | |
| 124 | 125 | closesocket(iSocket); |
| 125 | 126 | #else |
| 126 | 127 | close(iSocket); |
| 127 | 128 | #endif |
| 128 | 129 | iSocket = -1; |
| 129 | 130 |
| --- src/http_socket.c | |
| +++ src/http_socket.c | |
| @@ -119,10 +119,11 @@ | |
| 119 | ** is a no-op. |
| 120 | */ |
| 121 | void socket_close(void){ |
| 122 | if( iSocket>=0 ){ |
| 123 | #if defined(_WIN32) |
| 124 | closesocket(iSocket); |
| 125 | #else |
| 126 | close(iSocket); |
| 127 | #endif |
| 128 | iSocket = -1; |
| 129 |
| --- src/http_socket.c | |
| +++ src/http_socket.c | |
| @@ -119,10 +119,11 @@ | |
| 119 | ** is a no-op. |
| 120 | */ |
| 121 | void socket_close(void){ |
| 122 | if( iSocket>=0 ){ |
| 123 | #if defined(_WIN32) |
| 124 | if( shutdown(iSocket,1)==0 ) shutdown(iSocket,0); |
| 125 | closesocket(iSocket); |
| 126 | #else |
| 127 | close(iSocket); |
| 128 | #endif |
| 129 | iSocket = -1; |
| 130 |
+4
| --- src/winhttp.c | ||
| +++ src/winhttp.c | ||
| @@ -215,10 +215,12 @@ | ||
| 215 | 215 | |
| 216 | 216 | end_request: |
| 217 | 217 | if( out ) fclose(out); |
| 218 | 218 | if( aux ) fclose(aux); |
| 219 | 219 | if( in ) fclose(in); |
| 220 | + /* Initiate shutdown prior to closing the socket */ | |
| 221 | + if( shutdown(p->s,1)==0 ) shutdown(p->s,0); | |
| 220 | 222 | closesocket(p->s); |
| 221 | 223 | /* Make multiple attempts to delete the temporary files. Sometimes AV |
| 222 | 224 | ** software keeps the files open for a few seconds, preventing the file |
| 223 | 225 | ** from being deleted on the first try. */ |
| 224 | 226 | for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); } |
| @@ -280,10 +282,12 @@ | ||
| 280 | 282 | } |
| 281 | 283 | |
| 282 | 284 | end_request: |
| 283 | 285 | if( out ) fclose(out); |
| 284 | 286 | if( in ) fclose(in); |
| 287 | + /* Initiate shutdown prior to closing the socket */ | |
| 288 | + if( shutdown(p->s,1)==0 ) shutdown(p->s,0); | |
| 285 | 289 | closesocket(p->s); |
| 286 | 290 | /* Make multiple attempts to delete the temporary files. Sometimes AV |
| 287 | 291 | ** software keeps the files open for a few seconds, preventing the file |
| 288 | 292 | ** from being deleted on the first try. */ |
| 289 | 293 | for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); } |
| 290 | 294 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -215,10 +215,12 @@ | |
| 215 | |
| 216 | end_request: |
| 217 | if( out ) fclose(out); |
| 218 | if( aux ) fclose(aux); |
| 219 | if( in ) fclose(in); |
| 220 | closesocket(p->s); |
| 221 | /* Make multiple attempts to delete the temporary files. Sometimes AV |
| 222 | ** software keeps the files open for a few seconds, preventing the file |
| 223 | ** from being deleted on the first try. */ |
| 224 | for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); } |
| @@ -280,10 +282,12 @@ | |
| 280 | } |
| 281 | |
| 282 | end_request: |
| 283 | if( out ) fclose(out); |
| 284 | if( in ) fclose(in); |
| 285 | closesocket(p->s); |
| 286 | /* Make multiple attempts to delete the temporary files. Sometimes AV |
| 287 | ** software keeps the files open for a few seconds, preventing the file |
| 288 | ** from being deleted on the first try. */ |
| 289 | for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); } |
| 290 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -215,10 +215,12 @@ | |
| 215 | |
| 216 | end_request: |
| 217 | if( out ) fclose(out); |
| 218 | if( aux ) fclose(aux); |
| 219 | if( in ) fclose(in); |
| 220 | /* Initiate shutdown prior to closing the socket */ |
| 221 | if( shutdown(p->s,1)==0 ) shutdown(p->s,0); |
| 222 | closesocket(p->s); |
| 223 | /* Make multiple attempts to delete the temporary files. Sometimes AV |
| 224 | ** software keeps the files open for a few seconds, preventing the file |
| 225 | ** from being deleted on the first try. */ |
| 226 | for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); } |
| @@ -280,10 +282,12 @@ | |
| 282 | } |
| 283 | |
| 284 | end_request: |
| 285 | if( out ) fclose(out); |
| 286 | if( in ) fclose(in); |
| 287 | /* Initiate shutdown prior to closing the socket */ |
| 288 | if( shutdown(p->s,1)==0 ) shutdown(p->s,0); |
| 289 | closesocket(p->s); |
| 290 | /* Make multiple attempts to delete the temporary files. Sometimes AV |
| 291 | ** software keeps the files open for a few seconds, preventing the file |
| 292 | ** from being deleted on the first try. */ |
| 293 | for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); } |
| 294 |