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

[Libevent-users] Patch: Propagate errors on SSL bufferevents



Hi,

SSL bufferevents that use another bev as underlying source don't
propagate errors (like "connection closed") to the user. The
attached patch fixes this.

Best regards,
  Joachim

From dbaac89570df375721e1ed5a54ed52e4bee71e06 Mon Sep 17 00:00:00 2001
From: Joachim Bauch <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 26 Jul 2011 10:31:18 +0200
Subject: [PATCH] Propagate errors on the underlying bufferevent to the user.

---
 bufferevent_openssl.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/bufferevent_openssl.c b/bufferevent_openssl.c
index 2a448cd..b71d8ac 100644
--- a/bufferevent_openssl.c
+++ b/bufferevent_openssl.c
@@ -815,6 +815,9 @@ be_openssl_eventcb(struct bufferevent *bev_base, short what, void *ctx)
 	} else if (what & BEV_EVENT_TIMEOUT) {
 		/* We sure didn't set this.  Propagate it to the user. */
 		event = what;
+	} else if (what & BEV_EVENT_ERROR) {
+		/* An error occurred on the connection.  Propagate it to the user. */
+		event = what;
 	} else if (what & BEV_EVENT_CONNECTED) {
 		/* Ignore it.  We're saying SSL_connect() already, which will
 		   eat it. */
-- 
1.7.0.4