From c43acd97bd8a6264820dd2dcce57ff64760bbb16 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Tue, 16 Oct 2012 20:15:38 +0200 Subject: [PATCH] Fixed accept/connect state event propagation. Also removed some unused states and flags. --- src/network/common.h | 5 ----- src/network/openssl.c | 10 ++-------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/network/common.h b/src/network/common.h index 48eeec4..8270da2 100644 --- a/src/network/common.h +++ b/src/network/common.h @@ -20,11 +20,6 @@ #define NET_WANT_READ NET_EVENT_READ #define NET_WANT_WRITE NET_EVENT_WRITE #define NET_WANT_ACCEPT NET_EVENT_READ -#define NET_WANT_SSL_READ 0x0010 -#define NET_WANT_SSL_WRITE 0x0020 -#define NET_WANT_SSL_ACCEPT 0x0040 -#define NET_WANT_SSL_CONNECT 0x0080 -#define NET_WANT_SSL_X509_LOOKUP 0x0100 #define NET_SSL_ANY NET_WANT_SSL_READ | NET_WANT_SSL_WRITE | NET_WANT_SSL_ACCEPT | NET_WANT_SSL_CONNECT | NET_WANT_SSL_X509_LOOKUP diff --git a/src/network/openssl.c b/src/network/openssl.c index cd09d4d..322dfd1 100644 --- a/src/network/openssl.c +++ b/src/network/openssl.c @@ -320,9 +320,6 @@ void net_ssl_destroy(struct net_connection* con) void net_ssl_callback(struct net_connection* con, int events) { struct net_ssl_openssl* handle = get_handle(con); - int ret; - uint32_t flags = con->flags; - con->flags &= ~NET_SSL_ANY; /* reset the SSL related flags */ switch (handle->state) { @@ -335,15 +332,12 @@ void net_ssl_callback(struct net_connection* con, int events) break; case tls_st_accepting: - if (net_con_ssl_accept(con) < 0) - { + if (net_con_ssl_accept(con) != 0) con->callback(con, NET_EVENT_READ, con->ptr); - } break; case tls_st_connecting: - ret = net_con_ssl_connect(con); - if (ret != 0) + if (net_con_ssl_connect(con) != 0) con->callback(con, NET_EVENT_READ, con->ptr); break;