-/* $OpenBSD: server.c,v 1.3 2014/07/13 14:46:52 reyk Exp $ */
+/* $OpenBSD: server.c,v 1.4 2014/07/13 15:07:50 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
server_error(struct bufferevent *bev, short error, void *arg)
{
struct client *clt = arg;
+ struct evbuffer *dst;
if (error & EVBUFFER_TIMEOUT) {
server_close(clt, "buffer event timeout");
bufferevent_disable(bev, EV_READ|EV_WRITE);
clt->clt_done = 1;
- server_close(clt, "done");
+ if (bev != clt->clt_bev) {
+ dst = EVBUFFER_OUTPUT(clt->clt_bev);
+ if (EVBUFFER_LENGTH(dst))
+ return;
+ } else
+ return;
+
+ server_close(clt, "done");
return;
}
server_close(clt, "buffer event error");
-/* $OpenBSD: server_file.c,v 1.2 2014/07/13 14:17:37 reyk Exp $ */
+/* $OpenBSD: server_file.c,v 1.3 2014/07/13 15:07:50 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
bufferevent_settimeout(clt->clt_file,
srv->srv_conf.timeout.tv_sec, srv->srv_conf.timeout.tv_sec);
- bufferevent_enable(clt->clt_file, EV_READ|EV_WRITE);
+ bufferevent_enable(clt->clt_file, EV_READ);
return (0);
fail: