Flush output buffers in the tap reader thread on Windows.
This is basically a port of commit 50fcfea1
to 1.1.
This commit is contained in:
parent
4d05e695ab
commit
f9ab8e266b
4 changed files with 11 additions and 0 deletions
|
@ -245,6 +245,12 @@ bool event_loop(void) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void event_flush_output(void) {
|
||||
for splay_each(io_t, io, &io_tree)
|
||||
if(FD_ISSET(io->fd, &writefds))
|
||||
io->cb(io->data, IO_WRITE);
|
||||
}
|
||||
|
||||
void event_exit(void) {
|
||||
running = false;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ extern void signal_add(signal_t *sig, signal_cb_t cb, void *data, int signum);
|
|||
extern void signal_del(signal_t *sig);
|
||||
|
||||
extern bool event_loop(void);
|
||||
extern void event_flush_output(void);
|
||||
extern void event_exit(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -80,6 +80,7 @@ static DWORD WINAPI tapreader(void *bla) {
|
|||
packet.len = len;
|
||||
packet.priority = 0;
|
||||
route(myself, &packet);
|
||||
event_flush_output();
|
||||
LeaveCriticalSection(&mutex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,6 +349,9 @@ static void do_outgoing_pipe(connection_t *c, char *command) {
|
|||
}
|
||||
|
||||
static void handle_meta_write(connection_t *c) {
|
||||
if(c->outbuf.len <= c->outbuf.offset)
|
||||
return;
|
||||
|
||||
ssize_t outlen = send(c->socket, c->outbuf.data + c->outbuf.offset, c->outbuf.len - c->outbuf.offset, 0);
|
||||
if(outlen <= 0) {
|
||||
if(!errno || errno == EPIPE) {
|
||||
|
|
Loading…
Reference in a new issue