Skip to content

Instantly share code, notes, and snippets.

@itissid
Created November 24, 2010 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itissid/714606 to your computer and use it in GitHub Desktop.
Save itissid/714606 to your computer and use it in GitHub Desktop.
void static closeOnComplete(struct evbuffer *buffer,
const struct evbuffer_cb_info *info, void *arg){
struct total_processed *tp = (total_processed *)arg;
size_t towrite_n = tp->n;
size_t drained = info->n_deleted;
if(drained >= (towrite_n -1)){
//close the socket connection...
cout<<"***Done with draining***"<<endl;
cout<<drained<<" out of "<<towrite_n<<" bytes drained"<<endl;
//HTF to free a connection...
bufferevent_free(tp->bev);
}else{
cout<<"****WAIT FOR IT***"<<endl;
cout<<drained<<" out of "<<towrite_n<<" bytes drained"<<endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment