[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] [PATCH] http: on connection reset, detach the closed fd from the bufferevent
- To: libevent-users@xxxxxxxxxxxxx
- Subject: [Libevent-users] [PATCH] http: on connection reset, detach the closed fd from the bufferevent
- From: Catalin Patulea <catalinp@xxxxxxxxxx>
- Date: Wed, 19 Dec 2012 11:05:42 -0500
- Cc: Catalin Patulea <cat@xxxxxxxxxxxxxx>
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Wed, 19 Dec 2012 11:05:56 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=dDkcMO0g0M0Tfe8IkxPJ0vmuEgi6Pow3B8xm1PhJo5s=; b=fQbreLnKYzLX9KFKwfDOQKNEEVcYyqDcFhBlJdHB3Ackh/hQwELSsaryWOLnVOh3ud Ii1cd/8FZYPWBB1ocVOPmPwSRbyTnYkguKi6hlBj6jJhnNRp1vaI2ITCdZ3wtw1ZBYG4 7PAl0A7a0NG5gpTrWFElJdMkoVzvVBIjhQiKod4ONSOLJTlH2E7jBlLFCP2yz+nn8Yak 1Xd7U9VO501x+Gepu6GCjAsLqnjmQQ6fjqE/mk40UfvzJ7hE3beBKCpCXyb2xhpYlAau AUQBf/5+eCOWN14ZZWD6A/45843ZQo9rTtc2WDij7r67DUSo9hNXS3O0umTH6SDYkqPM UVHw==
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
From: Catalin Patulea <cat@xxxxxxxxxxxxxx>
I'm curious what people think of a patch like this.. I've been seeing fds getting reused and bufferevents adding/removing events on the underlying evmap when they shouldn't be touching that fd anymore.
This patch seems to fix it but I haven't fully considered the reprecussions of doing this.
Any first impressions on this?
Thanks,
Catalin
---
http.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/http.c b/http.c
index 22a46a9..8d871fd 100644
--- a/http.c
+++ b/http.c
@@ -1240,6 +1240,7 @@ evhttp_connection_reset_(struct evhttp_connection *evcon)
tmp = bufferevent_get_input(evcon->bufev);
evbuffer_drain(tmp, evbuffer_get_length(tmp));
+ bufferevent_setfd(evcon->bufev, -1);
evcon->state = EVCON_DISCONNECTED;
}
--
1.7.7.3
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.