]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
Call io_dontwantread only once on a socket
authorDirk Engling <erdgeist@erdgeist.org>
Sun, 14 Apr 2024 03:12:42 +0000 (05:12 +0200)
committerDirk Engling <erdgeist@erdgeist.org>
Sun, 14 Apr 2024 03:12:42 +0000 (05:12 +0200)
ot_http.c

index cce6dc2a405c987373eb0dfbde042b39908e4d39..1d4497a2f2dcfb8c9bcaf21098d7b8d50616689e 100644 (file)
--- a/ot_http.c
+++ b/ot_http.c
@@ -139,7 +139,10 @@ ssize_t http_sendiovecdata( const int64 sock, struct ot_workstruct *ws, int iove
   array_reset( &cookie->request );
 
   /* If we came here, wait for the answer is over */
-  cookie->flag &= ~STRUCT_HTTP_FLAG_WAITINGFORTASK;
+  if (cookie->flag & STRUCT_HTTP_FLAG_WAITINGFORTASK) {
+    io_dontwantread( sock );
+    cookie->flag &= ~STRUCT_HTTP_FLAG_WAITINGFORTASK;
+  }
 
 fprintf(stderr, "http_sendiovecdata sending %d iovec entries found cookie->batch == %p\n", iovec_entries, cookie->batch);
 
@@ -207,7 +210,6 @@ fprintf(stderr, "http_sendiovecdata adds a terminating 0 size buffer to batch\n"
   /* writeable sockets timeout after 10 minutes */
   taia_now( &t ); taia_addsec( &t, &t, OT_CLIENT_TIMEOUT_SEND );
   io_timeout( sock, t );
-  io_dontwantread( sock );
 fprintf (stderr, "http_sendiovecdata marks socket %lld as wantwrite\n", sock);
   io_wantwrite( sock );
   return 0;