From e357eb6de585e10763e8b2b368d1c56bfcf01d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 28 Nov 2013 23:17:12 +0100 Subject: [PATCH] Set a maximum read buffer for Libevent2TCPConnection to avoid huge memory consumption and other side effects. See http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/7927/ for "other" side effects. Note that this issue has another root cause, which is that .empty should not be true unless the read buffer has been fully emptied. Currently it is true as soon as the connection is closed by the remote. --- source/vibe/core/drivers/libevent2_tcp.d | 1 + 1 file changed, 1 insertion(+) diff --git a/source/vibe/core/drivers/libevent2_tcp.d b/source/vibe/core/drivers/libevent2_tcp.d index 7345c902f8..60bb02ce44 100644 --- a/source/vibe/core/drivers/libevent2_tcp.d +++ b/source/vibe/core/drivers/libevent2_tcp.d @@ -79,6 +79,7 @@ package class Libevent2TCPConnection : TCPConnection { m_peerAddress = cast(string)m_peerAddressBuf[0 .. m_peerAddressBuf.indexOf('\0')]; bufferevent_setwatermark(m_ctx.event, EV_WRITE, 4096, 65536); + bufferevent_setwatermark(m_ctx.event, EV_READ, 0, 65536); } ~this()