Skip to content

Commit

Permalink
Fix redsocks_evbuffer_readline with libevent 2.1
Browse files Browse the repository at this point in the history
_EVENT_NUMERIC_VERSION was renamed to EVENT__NUMERIC_VERSION in libevent
2.1. As a result, redsocks_evbuffer_readline would end up using
evbuffer_readline(buf), which causes client connections to hang
indefinitely.

Switch the check to using LIBEVENT_VERSION_NUMBER instead.
LIBEVENT_VERSION_NUMBER has been around since libevent 2.0.3 and
redsocks is already using it in other parts of the code.

Fixes darkk#107, darkk#122.
  • Loading branch information
apoikos committed Mar 29, 2018
1 parent 5df6a30 commit 792a06b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int redsocks_gettimeofday(struct timeval *tv)

char *redsocks_evbuffer_readline(struct evbuffer *buf)
{
#if _EVENT_NUMERIC_VERSION >= 0x02000000
#if LIBEVENT_VERSION_NUMBER >= 0x02000000
return evbuffer_readln(buf, NULL, EVBUFFER_EOL_CRLF);
#else
return evbuffer_readline(buf);
Expand Down

0 comments on commit 792a06b

Please sign in to comment.