> Le 28 déc. 2017 à 17:37, Olivier Mascia <[email protected]> a écrit :
>
> The quick/easy/dirty/temporary fix before completing the proper support
> (server-side) of IPv4+IPv6 would be to simply adjust the hint.ai_family
> initialisation in http_socket.c::socket_open to read:
>
> #ifdef _WIN32
> hints.ai_family = AF_INET;
> #else
> hints.ai_family = g.fIPv4 ? AF_INET : AF_UNSPEC;
> #endif
>
> It works nicely for me. Perfectly expected performance of a large clone
> (needing 250 round-trips) in about 50 seconds. Either using explicitly IPv4
> in the URL or, with that patch, the proper DNS name.
To further clarify, here is the patching I did today based on fossil version
2.5 [f4a9df4dd0] 2017-12-23 04:21:41 UTC.
There is that discussed temporary limitation of the client-side (on Windows) to
resolving only to IPv4 (to match the server being only IPv4) and another small
change which is to call shutdown() on sockets before calling closesocket().
It is more interesting in winhttp.c than in http_socket.c, because it will help
the windows TCP stack to more cleanly and generally more quickly free up kernel
resources by sending the proper TCP FIN before getting rid of the socket. Kind
of warning "I'm pulling the plug" before actually doing so.
Don't expect measurable performance improvement from that. The only benefit
would be seen under rare situations when the server machine has thousands of
other sockets active (maybe other softwares than Fossil). And even so, would be
seen only if those other software also behave 'by the book'.
Index: src/http_socket.c
==================================================================
--- src/http_socket.c
+++ src/http_socket.c
@@ -119,10 +119,12 @@
** is a no-op.
*/
void socket_close(void){
if( iSocket>=0 ){
#if defined(_WIN32)
+ if (shutdown(iSocket, 1/*SD_SEND*/) == 0) /* Initiates the shutdown,
sending TCP 'FIN' */
+ shutdown(iSocket, 0/*SD_RECEIVE*/); /* Now denies receive */
closesocket(iSocket);
#else
close(iSocket);
#endif
iSocket = -1;
@@ -147,11 +149,15 @@
char zRemote[NI_MAXHOST];
socket_global_init();
socket_close();
memset(&hints, 0, sizeof(struct addrinfo));
+#ifdef _WIN32
+ hints.ai_family = AF_INET;
+#else
hints.ai_family = g.fIPv4 ? AF_INET : AF_UNSPEC;
+#endif
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
sqlite3_snprintf(sizeof(zPort),zPort,"%d", pUrlData->port);
rc = getaddrinfo(pUrlData->name, zPort, &hints, &ai);
if( rc ){
Index: src/winhttp.c
==================================================================
--- src/winhttp.c
+++ src/winhttp.c
@@ -214,10 +214,12 @@
}
end_request:
if( out ) fclose(out);
if( in ) fclose(in);
+ if (shutdown(p->s, 1/*SD_SEND*/) == 0) /* Initiates the shutdown, sending
TCP 'FIN' */
+ shutdown(p->s, 0/*SD_RECEIVE*/); /* Now denies receive */
closesocket(p->s);
file_delete(zRequestFName);
file_delete(zReplyFName);
file_delete(zCmdFName);
fossil_free(p);
@@ -277,10 +279,12 @@
}
end_request:
if( out ) fclose(out);
if( in ) fclose(in);
+ if (shutdown(p->s, 1/*SD_SEND*/) == 0) /* Initiates the shutdown, sending
TCP 'FIN' */
+ shutdown(p->s, 0/*SD_RECEIVE*/); /* Now denies receive */
closesocket(p->s);
file_delete(zRequestFName);
file_delete(zReplyFName);
fossil_free(p);
}
--
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users