Author :
Azat Khuzhin
Date :
2017-12-18 02:02:15
Hash :2653be97 Message :evbuffer_add_file: do not use evbuffer_remove(), instead calc offset for mmap()
@ellzey:
"when evbuffer_add_file is called and mmap is used, if the offset
argument is >0, a mistake happens: add_file removes "offset" byts
from the front of the evbuffer.
So that means any data that was previously on the buffer is trimmed
off by "offset" bytes. Whoops."
And even more when offset>0, evbuffer_add_file() still maps whole file,
let's calc appropriate offset and length.
And here is the wrong fix:
https://github.com/libevent/libevent/commit/afca576a052fb8c83e771435169615fce5c56686