commit e32594ba3332114c47ccee9cd628fe24a59885aa
parent 5e5eec6b7e63cbd2b6cb5a8c9c2af6522106b4a6
Author: mrbesen <y.g.2@gmx.de>
Date: Sat, 21 Jan 2023 12:41:33 +0100
fix first http ping is slower than the rest.
Diffstat:
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/httping.c b/httping.c
@@ -64,9 +64,6 @@ void DoHTTPing( const char * addy, double minperiod, int * seqnoptr, volatile do
int portno = 80;
- (*seqnoptr) ++;
- HTTPingCallbackStart( *seqnoptr );
-
if( eportmarker )
{
portno = atoi( eportmarker+1 );
@@ -137,6 +134,10 @@ reconnect:
char buf[8192];
int n = sprintf( buf, "HEAD %s HTTP/1.1\r\nConnection: keep-alive\r\nHost: %s\r\n\r\n", eurl?eurl:"/favicon.ico", hostname );
+
+ (*seqnoptr) ++;
+ HTTPingCallbackStart( *seqnoptr );
+
int rs = send( httpsock, buf, n, MSG_NOSIGNAL );
double starttime = *timeouttime = OGGetAbsoluteTime();
int breakout = 0;
@@ -175,8 +176,6 @@ reconnect:
double delay_time = minperiod - (*timeouttime - starttime);
if( delay_time > 0 )
usleep( (int)(delay_time * 1000000) );
- (*seqnoptr) ++;
- HTTPingCallbackStart( *seqnoptr );
if( !breakout ) {
#ifdef WIN32
closesocket( httpsock );