Fix some nasty bugs related to read/write events and timeout events.

This would have caused users not being able to log in, and in some cases
100% cpu usage.
This commit is contained in:
Jan Vidar Krey
2009-07-19 02:12:50 +02:00
parent abd097acf0
commit 4a173bf066
6 changed files with 51 additions and 76 deletions

View File

@@ -95,7 +95,8 @@ struct user_limits
struct user_net_io
{
int sd; /** socket descriptor */
struct event* ev_read; /** libevent struct for read events */
struct event event; /** libevent struct for read/write events */
struct event timeout; /** timeout handling */
struct hub_recvq* recv_queue;
struct hub_sendq* send_queue;
@@ -286,7 +287,13 @@ extern void user_net_io_want_write(struct user* user);
/**
* Mark the user with a want read flag, meaning it should poll for readability.
*/
extern void user_net_io_want_read(struct user* user, int timeout_s);
extern void user_net_io_want_read(struct user* user);
/**
* Set timeout for connetion.
* @param seconds the number of seconds into the future.
*/
extern void user_set_timeout(struct user* user, int seconds);
/**
* Reset the last-write timer.