Fixed accept/connect state event propagation.

Also removed some unused states and flags.
This commit is contained in:
Jan Vidar Krey 2012-10-16 20:15:38 +02:00
parent b1f2c93738
commit c43acd97bd
2 changed files with 2 additions and 13 deletions

View File

@ -20,11 +20,6 @@
#define NET_WANT_READ NET_EVENT_READ #define NET_WANT_READ NET_EVENT_READ
#define NET_WANT_WRITE NET_EVENT_WRITE #define NET_WANT_WRITE NET_EVENT_WRITE
#define NET_WANT_ACCEPT NET_EVENT_READ #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 #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

View File

@ -320,9 +320,6 @@ void net_ssl_destroy(struct net_connection* con)
void net_ssl_callback(struct net_connection* con, int events) void net_ssl_callback(struct net_connection* con, int events)
{ {
struct net_ssl_openssl* handle = get_handle(con); 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) switch (handle->state)
{ {
@ -335,15 +332,12 @@ void net_ssl_callback(struct net_connection* con, int events)
break; break;
case tls_st_accepting: 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); con->callback(con, NET_EVENT_READ, con->ptr);
}
break; break;
case tls_st_connecting: case tls_st_connecting:
ret = net_con_ssl_connect(con); if (net_con_ssl_connect(con) != 0)
if (ret != 0)
con->callback(con, NET_EVENT_READ, con->ptr); con->callback(con, NET_EVENT_READ, con->ptr);
break; break;