summaryrefslogtreecommitdiff
path: root/opentracker.c
diff options
context:
space:
mode:
Diffstat (limited to 'opentracker.c')
-rw-r--r--opentracker.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/opentracker.c b/opentracker.c
index e5efff5..2f2746d 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -29,6 +29,7 @@
29#include "ot_ip.h" 29#include "ot_ip.h"
30#include "ot_livesync.h" 30#include "ot_livesync.h"
31#include "ot_mutex.h" 31#include "ot_mutex.h"
32#include "ot_workqueue.h"
32#include "ot_random.h" 33#include "ot_random.h"
33#include "ot_scan.h" 34#include "ot_scan.h"
34#include "ot_event.h" 35#include "ot_event.h"
@@ -137,16 +138,18 @@ static void *server_mainloop(void *args) {
137 else if ((intptr_t)cookie == FLAG_SELFPIPE) 138 else if ((intptr_t)cookie == FLAG_SELFPIPE)
138 while (read((int)sock, ws.inbuf, G_INBUF_SIZE) > 0) 139 while (read((int)sock, ws.inbuf, G_INBUF_SIZE) > 0)
139 ; 140 ;
140 else { 141 else if (fdstate_claim((int)sock, ready[i].generation)) {
141 if (ready[i].what & EVENT_IN) 142 if (ready[i].what & EVENT_IN)
142 tcp_read(sock, &ws); 143 tcp_read(sock, &ws);
143 /* The read may have closed it, so look again before writing */ 144 /* The read may have closed it, so look again before writing */
144 if ((ready[i].what & EVENT_OUT) && fdstate_generation((int)sock) == ready[i].generation) 145 if ((ready[i].what & EVENT_OUT) && fdstate_generation((int)sock) == ready[i].generation)
145 tcp_write(sock); 146 tcp_write(sock);
147 if (fdstate_generation((int)sock) == ready[i].generation)
148 fdstate_release((int)sock);
146 } 149 }
147 } 150 }
148 151
149 while ((sock = mutex_workqueue_popresult(&iovec_entries, &iovector, &is_partial)) != -1) 152 while ((sock = workqueue_popresult(&iovec_entries, &iovector, &is_partial)) != -1)
150 http_sendiovecdata(sock, &ws, iovec_entries, iovector, is_partial); 153 http_sendiovecdata(sock, &ws, iovec_entries, iovector, is_partial);
151 154
152 if (time_now_seconds() > next_timeout_check) { 155 if (time_now_seconds() > next_timeout_check) {