Added lots of asserts, and split out the ip address from the connection object.

Still a lot of work remains and a massive network connection cleanup is needed.
This commit is contained in:
Jan Vidar Krey
2009-09-28 23:15:15 +02:00
parent a53c219f05
commit 69f6d811bf
11 changed files with 54 additions and 32 deletions

View File

@@ -55,7 +55,6 @@ struct net_connection
net_connection_cb callback; /** Callback function */
struct event event; /** libevent struct for read/write events */
struct event timeout; /** Used for internal timeout handling */
struct ip_addr_encap ipaddr; /** IP address of peer */
time_t last_recv; /** Timestamp for last recv() */
time_t last_send; /** Timestamp for last send() */
#ifdef SSL_SUPPORT
@@ -64,7 +63,7 @@ struct net_connection
#endif /* SSL_SUPPORT */
};
extern void net_con_initialize(struct net_connection* con, int sd, struct ip_addr_encap*, net_connection_cb callback, const void* ptr, int events);
extern void net_con_initialize(struct net_connection* con, int sd, net_connection_cb callback, const void* ptr, int events);
extern void net_con_update(struct net_connection* con, int events);
/**
@@ -101,12 +100,6 @@ extern ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len);
extern void net_con_set_timeout(struct net_connection* con, int seconds);
extern void net_con_clear_timeout(struct net_connection* con);
/**
* Returns a string representation of the ipaddr member.
* NOTE: Static buffer.
*/
extern const char* net_con_get_peer_address(struct net_connection* con);
#ifdef SSL_SUPPORT
/**
* Start SSL_accept()