Hi,I am using libevent 2.03 alpha 1 to create an
app. The app structure is as follows:
A C++ app wraps lib event to listen on a domain socket. I use buffered events. As you can see in the post, the post above is a simple server that loops over a set of docs and creates many connections to this server.
I am new to this so please spare my flaky concepts, I want to clarify my doubt
1) I am using a buffered event that uses sockets as its underlying transport means. Everytime a connection is received a connection handler forms an eventbuffer, attaches a write handler and a eventcb handler.
2) I recieve some data from the client, I read a line process it and write it onto the output buffer of the bufferevent object.
The problem: Now I want to just flush this buffer and close the underlying transport(socket) after data has been flushed. I will call the evbuffer_add only once for each line recieved and after that no more data will be written to that specific o/p buffer.
So at this point i know exactly how much data to write. I need to reliably close this connection after all these bytes are out. How to achieve this?
Sid