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

[Libevent-users] how to prevent server close the connection?



here is the handler code, is there any thing wrong?

     void HTTPServer::CometHandler(struct evhttp_request *req, void *arg) {
   71       int i, j;
.> 72       cout << "inside coment handler" << endl;
   73       struct evbuffer *buf;
   74
   75       req->minor = 0;
   76       evhttp_add_header(req->output_headers, "Content-Type",
"text/plain");
   77
   78       evhttp_send_reply_start(req, HTTP_OK, "OK");
   79       evhttp_connection_set_closecb(req->evcon, on_close, NULL);
   80
   81       buf = evbuffer_new();
   82       evbuffer_add_printf(buf, "hello comet");
   83       evhttp_send_reply_chunk(req, buf);
   84
   85     }
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.