#5964: Follow-up fix for #5456 (encrypted communication with libevent 2.1.x)

I've misread libevent documentation and the check introduced was not
entirely correct. Changed `evbuffer_peek` call now to only request the
data which would fit into provided iovec.
This commit is contained in:
Mike Gelfand 2015-06-24 20:38:41 +00:00
parent 6101a69957
commit cdcc9e249f
1 changed files with 1 additions and 1 deletions

View File

@ -1148,7 +1148,7 @@ tr_peerIoReadBytesToBuf (tr_peerIo * io, struct evbuffer * inbuf, struct evbuffe
struct evbuffer_iovec iovec;
evbuffer_ptr_set (outbuf, &pos, old_length, EVBUFFER_PTR_SET);
do {
if (evbuffer_peek (outbuf, byteCount, &pos, &iovec, 1) != 1)
if (evbuffer_peek (outbuf, -1, &pos, &iovec, 1) != 1)
break;
tr_cryptoDecrypt (&io->crypto, iovec.iov_len, iovec.iov_base, iovec.iov_base);
byteCount -= iovec.iov_len;