[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] how to prevent server close the connection?
- To: libevent-users@xxxxxxxxxxxxx
- Subject: [Libevent-users] how to prevent server close the connection?
- From: æç|åäæ <calidion@xxxxxxxxx>
- Date: Mon, 27 Jun 2011 18:37:27 +0800
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Mon, 27 Jun 2011 06:37:55 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=s/gRA9EhULjLUf6/ARSQsf4b3oQpwTFQXTlIHBC2xzE=; b=dBGc93pTMrEDdRA3e9cjxYc3GAmLU7GbY/ZPp/ADLhjbcUfPgOiRrZDyMstky+dRru kpLgpZjkrFaqJiHGiw0hPDjtMFth5dI9+Nzw2VdDyXKqwRpKrLvvQMv8/3APVx6FerDs rJPwrNNhG2QeCMDtys0CJI/43NS6+OiZ3C/Yo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=L9cHJw1CQsMljvFx9PiUsQ7ZOxXy84kd5eKEx82G7YZLiKVofFWm0Q7PVjHGL1DO2r o5mSkGLhYIwiWZXUIK/wTyh6D5wIGvbDr2eGz6umjwQSiM8SU8k0AHNurjZT8t3YvLHZ 5bnqcxZPHkEYot2y6SDGqlxdJmT9nGZCgbpnk=
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
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.