[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] question about evhttp_connection_free
- To: libevent-users@xxxxxxxxxxxxx
- Subject: [Libevent-users] question about evhttp_connection_free
- From: Han LIU <cn.liuhan@xxxxxxxxx>
- Date: Thu, 28 Oct 2010 00:17:18 +0800
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Wed, 27 Oct 2010 12:17:25 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=tYv0TPO7qOzBTopKYWjjddhLxO+7pRRatktFYTAhPE0=; b=vPWLYkOYfJTHjHHIeH+XVgeM4qg00sk0T3xOIfSF7GrwoqalaPRSLBoUoWnNdIHVL4 GS1SRLiGUNxaP6u3hMEjy4vicfAuOm34YwPVakha7BbOeDv4JtLYhMXLvxvnN8Dr2tZp 4yeMZpNkuoFevYaRWyZ2/1qti3YTNU2T6JreA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=ZiJ3JcmEwqQB6SpRcItT8kM90OmfLN+VUVNO3tU4ucxyVY8uKsGj+Yid2dxkJEyVs1 i/WYXT2p2QxQlyaxgBZuyRrC74rTHU2npwIZ7xTHq58/RMIdDYRHR/e4sN42aDTAxTSw T9M9yU03KYXouswOP9lKuU8eqHJ4TThYatbxM=
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
hi mate
I have a question on evhttp_connection_free function.
Should i call evhttp_connection_free function manually in the
http_request_done call back?
here is some dummy code for this situation
http_request_done_callback(struct evhttp_request *req, void *arg)
{
if (req->evcon != NULL)
evhttp_connection_free(req->evcon);
}
request_function()
{
struct evhttp_connection *evcon = NULL;
struct evhttp_request *req = NULL;
evcon = evhttp_connection_base_new (u->eb, NULL, server_name, server_port);
evhttp_connection_set_timeout (evcon, 30);
evhttp_connection_set_retries (evcon, 5);
req = evhttp_request_new (sendmessage_http_request_done, NULL);
if (evhttp_make_request (evcon, req, EVHTTP_REQ_GET, uri) == -1)
{
evhttp_connection_free (hco->evcon);
}
}
thanks in advance
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.