Skip to content

Commit

Permalink
Set a maximum read buffer for Libevent2TCPConnection to avoid huge me…
Browse files Browse the repository at this point in the history
…mory 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.
  • Loading branch information
s-ludwig committed Nov 28, 2013
1 parent 6ad28ad commit e357eb6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions source/vibe/core/drivers/libevent2_tcp.d
Expand Up @@ -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()
Expand Down

0 comments on commit e357eb6

Please sign in to comment.