diff options
| -rw-r--r-- | opentracker.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/opentracker.c b/opentracker.c index e5efff5..6e073e9 100644 --- a/opentracker.c +++ b/opentracker.c | |||
| @@ -137,12 +137,14 @@ static void *server_mainloop(void *args) { | |||
| 137 | else if ((intptr_t)cookie == FLAG_SELFPIPE) | 137 | else if ((intptr_t)cookie == FLAG_SELFPIPE) |
| 138 | while (read((int)sock, ws.inbuf, G_INBUF_SIZE) > 0) | 138 | while (read((int)sock, ws.inbuf, G_INBUF_SIZE) > 0) |
| 139 | ; | 139 | ; |
| 140 | else { | 140 | else if (fdstate_claim((int)sock, ready[i].generation)) { |
| 141 | if (ready[i].what & EVENT_IN) | 141 | if (ready[i].what & EVENT_IN) |
| 142 | tcp_read(sock, &ws); | 142 | tcp_read(sock, &ws); |
| 143 | /* The read may have closed it, so look again before writing */ | 143 | /* 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) | 144 | if ((ready[i].what & EVENT_OUT) && fdstate_generation((int)sock) == ready[i].generation) |
| 145 | tcp_write(sock); | 145 | tcp_write(sock); |
| 146 | if (fdstate_generation((int)sock) == ready[i].generation) | ||
| 147 | fdstate_release((int)sock); | ||
| 146 | } | 148 | } |
| 147 | } | 149 | } |
| 148 | 150 | ||
