Move the network related flags from network.h to connection.h since that is where they are used.

This commit is contained in:
Jan Vidar Krey 2009-08-11 21:29:51 +02:00
parent 86ba3ca86f
commit 5bd258ca52
3 changed files with 24 additions and 15 deletions

View File

@ -155,6 +155,12 @@ void net_con_update(struct net_connection* con, int ev)
void net_con_close(struct net_connection* con)
{
if (net_con_flag_get(con, NET_CLEANUP))
{
LOG_INFO("Running net_con_close, but we already have closed...");
return;
}
if (event_pending(&con->event, EV_READ | EV_WRITE, 0))
{
event_del(&con->event);
@ -163,6 +169,8 @@ void net_con_close(struct net_connection* con)
net_con_clear_timeout(con);
net_close(con->sd);
con->sd = -1;
net_con_flag_set(con, NET_CLEANUP);
}
#ifdef SSL_SUPPORT

View File

@ -22,6 +22,22 @@
#include "uhub.h"
#define NET_WANT_READ 0x0001
#define NET_WANT_WRITE 0x0002
#define NET_WANT_ACCEPT 0x0008
#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_CLEANUP 0x8000
#define NET_EVENT_TIMEOUT 0x0001
#define NET_EVENT_READ 0x0002
#define NET_EVENT_WRITE 0x0004
#define NET_EVENT_SOCKERROR 0x1000 /* Socket error, closed */
#define NET_EVENT_CLOSED 0x2000 /* Socket closed */
struct net_connection;
typedef void (*net_connection_cb)(struct net_connection*, int event, void* ptr);

View File

@ -32,21 +32,6 @@ struct net_statistics
struct net_socket_t;
#define NET_WANT_READ 0x0001
#define NET_WANT_WRITE 0x0002
#define NET_WANT_ACCEPT 0x0008
#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_EVENT_TIMEOUT 0x0001
#define NET_EVENT_READ 0x0002
#define NET_EVENT_WRITE 0x0004
#define NET_EVENT_SOCKERROR 0x1000 /* Socket error, closed */
#define NET_EVENT_CLOSED 0x2000 /* Socket closed */
/**
* Initialize the socket monitor subsystem.
* On some operating systems this will also involve loading the TCP/IP stack