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

[Libevent-users] Seeking advice on handling a -1 return value from bufferevent_write()



Hello,

I'm successfully using bufferevent_write() to send message frames that are handled by bufferevent_read().  However, I'd like to handle a possible return value of -1 in the most optimal way (meaning, give the application the best of chance of succeeding on a retry of bufferevent_write()).

A return value of -1 from bufferevent_write() can mean that either that a libevent-specific error has occurred, or malloc() has failed to add the frame to the linked list of chains.  Assuming that the latter has occurred, I'm thinking of either reconnecting (using sockets) and/or reallocating the frame before a retry, or breaking the frame in half, and trying to resend it in 2 pieces.

Is there a better approach using the libevent functions?

Thanks,
Joe

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