Fossil

Check-in [ef44abc6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Initiate the TCP FIN on Windows before closing a socket.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ef44abc6db1682451c11a140207723980643cbf38667f4d0971a8db1ac8558ec
User & Date: drh 2017-12-28 21:06:50.198
Context
2017-12-28
21:52
Updated the Xekri skin to work with the recent Timeline changes. ... (check-in: c105c2fd user: zakero tags: trunk)
21:06
Initiate the TCP FIN on Windows before closing a socket. ... (check-in: ef44abc6 user: drh tags: trunk)
20:37
Improvements to "fossil server" performance on Windows. ... (check-in: 47ade67e user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/http_socket.c.
117
118
119
120
121
122
123

124
125
126
127
128
129
130
/*
** Close the currently open socket.  If no socket is open, this routine
** is a no-op.
*/
void socket_close(void){
  if( iSocket>=0 ){
#if defined(_WIN32)

    closesocket(iSocket);
#else
    close(iSocket);
#endif
    iSocket = -1;
  }
}







>







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
** Close the currently open socket.  If no socket is open, this routine
** is a no-op.
*/
void socket_close(void){
  if( iSocket>=0 ){
#if defined(_WIN32)
    if( shutdown(iSocket,1)==0 ) shutdown(iSocket,0);
    closesocket(iSocket);
#else
    close(iSocket);
#endif
    iSocket = -1;
  }
}
Changes to src/winhttp.c.
213
214
215
216
217
218
219


220
221
222
223
224
225
226
    }
  }

end_request:
  if( out ) fclose(out);
  if( aux ) fclose(aux);
  if( in ) fclose(in);


  closesocket(p->s);
  /* Make multiple attempts to delete the temporary files.  Sometimes AV
  ** software keeps the files open for a few seconds, preventing the file
  ** from being deleted on the first try. */
  for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); }
  for(i=1; i<=10 && file_delete(zCmdFName); i++){ Sleep(1000*i); }
  for(i=1; i<=10 && file_delete(zReplyFName); i++){ Sleep(1000*i); }







>
>







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
    }
  }

end_request:
  if( out ) fclose(out);
  if( aux ) fclose(aux);
  if( in ) fclose(in);
  /* Initiate shutdown prior to closing the socket */
  if( shutdown(p->s,1)==0 ) shutdown(p->s,0);
  closesocket(p->s);
  /* Make multiple attempts to delete the temporary files.  Sometimes AV
  ** software keeps the files open for a few seconds, preventing the file
  ** from being deleted on the first try. */
  for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); }
  for(i=1; i<=10 && file_delete(zCmdFName); i++){ Sleep(1000*i); }
  for(i=1; i<=10 && file_delete(zReplyFName); i++){ Sleep(1000*i); }
278
279
280
281
282
283
284


285
286
287
288
289
290
291
      send(p->s, zHdr, got, 0);
    }
  }

end_request:
  if( out ) fclose(out);
  if( in ) fclose(in);


  closesocket(p->s);
  /* Make multiple attempts to delete the temporary files.  Sometimes AV
  ** software keeps the files open for a few seconds, preventing the file
  ** from being deleted on the first try. */
  for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); }
  for(i=1; i<=10 && file_delete(zReplyFName); i++){ Sleep(1000*i); }
  fossil_free(p);







>
>







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
      send(p->s, zHdr, got, 0);
    }
  }

end_request:
  if( out ) fclose(out);
  if( in ) fclose(in);
  /* Initiate shutdown prior to closing the socket */
  if( shutdown(p->s,1)==0 ) shutdown(p->s,0);
  closesocket(p->s);
  /* Make multiple attempts to delete the temporary files.  Sometimes AV
  ** software keeps the files open for a few seconds, preventing the file
  ** from being deleted on the first try. */
  for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); }
  for(i=1; i<=10 && file_delete(zReplyFName); i++){ Sleep(1000*i); }
  fossil_free(p);