[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] evbuffer_pullup contain buffer which contain header information of next packet



Sorry, I actually forget to inform you that the packet header contain the length of the payload data. I have a buffer event filter function which returns BEV_OK after ensuring that event buffer contains data of atleast length bytes excluding header length. Once the filter function return BEV_OK , libevent is invoking my callback function inside which I do a evbuffer_pullup passing lenght of the payload data as argument.

On Jul 26, 2017 7:36 PM, "Azat Khuzhin" <a3at.mail@xxxxxxxxx> wrote:
On Wed, Jul 26, 2017 at 5:00 PM, ravi chandran <ravigct27@xxxxxxxxx> wrote:
> Hi,
>      I am using using libevent 2.0.  Two applications are communicating each
> other using unix stream sockets(named socket). In one of the application , i
> am pulling up the data using evbuffer_pullup() from the received event
> buffer. But i see corrupted data in it from certain offset onwards on the
> received event buffer.
> Each packet contain a header and a payload. The corruption is happened in
> such a way that a packet data contains next packet header innformation
> instead of actual data. This  issue is happening very rarely.
>  I dont see sender application is sending the corrupted data.
>
> Can someone clarify whether any known issue exist in libevent in
> evbuffer_pullup() or other dependant function which results in above data

Hi,

Looks like you are waiting that returned buffer from evbuffer_pullup()
will be null-terminated, while this is not true, and you should use
evbuffer_get_length() to know the length of the buffer.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.