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

[Libevent-users] bufferevents and write signalling



This is an odd question that hopefully someone can help me out with. I
have a function right now that looks a bit like this:

void 
read_data(struct bufferevent *bev, void *args) {
	evbuffer *data;

	data = bufferevent_get_input(bev) 

  if (evbuffer_get_length(data) < some_size) {
		/* waiting for some specific amount of data */
		return;

  .... process data here ....

	evbuffer_drain(data, some_size);

  if (evbuffer_get_length(data)) {
		return read_data(bev, args);
	}
}

If more data is present at the time it has finished reading one block of
data it was interested in, if you were to return, you never get notified 
unless something was added.	

To me this seems to be a bad situation to be in as you are technically
blocking at this point.

When using normal event_set/add I could simply force the event EV_WRITE,
and it would call my function again when it could. Is there something I
can do with bufferevent's to mimic that type of behaviour?

Thanks in advance!
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.