[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Bufferevent timeouts unclear.
After some digging, I've managed to figure it out.
The order of calls makes all the difference, so, it would be nice if you explicitly mentioned it in your book, Nick (great resource, btw!).
This works:
bufferevent_setcb(bev, readcb, NULL, eventcb, NULL);
if (bufferevent_socket_connect(bev,(struct sockaddr *)&sin, sizeof(sin)) < 0)
{
bufferevent_free(bev);
}
bufferevent_setwatermark(bev, EV_READ, X, 0);
bufferevent_enable(bev, EV_READ|EV_WRITE);
bufferevent_set_timeouts(bev, &tv, &tv);
But, setting the watermarks, or timeouts before the socket_connect doesn't, which, is quite confusing, as you can add data to the buffer before adding the connection, this makes it quite confusing, imo, as it seems arbitrary.
Regardless, I hope this'll help someone out.
Thanks again for the book!
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.