Rework the calculation of the select timeout in io() to be based on absolute wake time
An absolute wake time is now calculated and updated by set_server_bits(), TimerTimeout() and tclTimerTimeout(). This is then used to calculate the actual select() timeout, instead of having those functions calculate a relative timeout value themselves. This significantly simplifies those functions, since the underlying values tend to be recorded as absolute times. It also allows us to disentangle tclTimeTimeout from TimerTimeout(), and move the responsibility for calculating the QUEUE_SENDS wake time from TimerTimeout() to set_server_bits() where it belongs. The QUEUE_SENDS and CONNECT_DELAY wake up times will also now be correctly calculated, based on the last sent time and connect time respectively.
This commit is contained in:
@@ -227,7 +227,7 @@ extern SGroup *server_group_list;
|
||||
void BX_server_is_connected (int, int);
|
||||
int BX_parse_server_index (char *);
|
||||
void BX_parse_server_info (char *, char **, char **, char **, char **);
|
||||
long set_server_bits (fd_set *, fd_set *);
|
||||
void set_server_bits (fd_set *rd, fd_set *wr, struct timeval *wake_time);
|
||||
void BX_set_server_itsname (int, char *);
|
||||
void BX_set_server_version (int, int);
|
||||
char *BX_get_possible_umodes(int);
|
||||
|
||||
@@ -19,6 +19,7 @@ typedef struct {
|
||||
|
||||
extern cmd_t C_msg[];
|
||||
extern cmd_t C_dcc[];
|
||||
void tclTimerTimeout(struct timeval *wake_time);
|
||||
int check_tcl_dcc (char *, char *, char *, int);
|
||||
|
||||
void tcl_command (char *, char *, char *, char *);
|
||||
|
||||
@@ -16,14 +16,9 @@ extern int kill_timer(char *);
|
||||
extern void BX_delete_all_timers (void);
|
||||
extern int timer_exists (char *ref);
|
||||
|
||||
|
||||
extern time_t TimerTimeout (void);
|
||||
void TimerTimeout(struct timeval *wake_time);
|
||||
char *tcl_add_timer (TimerList **, long, char *, unsigned long);
|
||||
int tcl_remove_timer (TimerList **, unsigned long);
|
||||
int timer_callback_exists(void *);
|
||||
|
||||
time_t tclTimerTimeout(time_t);
|
||||
|
||||
#define MAGIC_TIMEOUT 100000000
|
||||
|
||||
#endif /* _TIMER_H_ */
|
||||
|
||||
Reference in New Issue
Block a user