[srvx-commits] CVS: services/src ioset.c,1.18,1.19 ioset.h,1.9,1.10 proto-p10.c,1.80,1.81
Brought to you by:
entrope
From: Entrope <en...@us...> - 2003-10-28 05:02:43
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv1772/src Modified Files: ioset.c ioset.h proto-p10.c Log Message: when we set the time, update 'now' instead of just 'clock_skew' Index: ioset.c =================================================================== RCS file: /cvsroot/srvx/services/src/ioset.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** ioset.c 26 Sep 2003 15:16:58 -0000 1.18 --- ioset.c 28 Oct 2003 04:56:28 -0000 1.19 *************** *** 42,46 **** extern int uplink_connect(void); ! int clock_skew; int do_write_dbs; int do_reopen; --- 42,46 ---- extern int uplink_connect(void); ! static int clock_skew; int do_write_dbs; int do_reopen; *************** *** 436,438 **** --- 436,444 ---- fd->send.put += nbw; if (fd->send.put == fd->send.size) fd->send.put = 0; + } + + void + ioset_set_time(unsigned long new_now) { + clock_skew = new_now - time(NULL); + now = new_now; } Index: ioset.h =================================================================== RCS file: /cvsroot/srvx/services/src/ioset.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** ioset.h 7 Jul 2003 16:29:33 -0000 1.9 --- ioset.h 28 Oct 2003 04:56:28 -0000 1.10 *************** *** 56,59 **** --- 56,60 ---- void ioset_close(int fd, int os_close); void ioset_cleanup(void); + void ioset_set_time(unsigned long new_now); #endif /* !defined(IOSET_H) */ Index: proto-p10.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto-p10.c,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -r1.80 -r1.81 *** proto-p10.c 26 Oct 2003 14:02:34 -0000 1.80 --- proto-p10.c 28 Oct 2003 04:56:28 -0000 1.81 *************** *** 533,537 **** irc_settime(const char *srv_name_mask, time_t new_time) { ! clock_skew = new_time - time(NULL); if (!strcmp(srv_name_mask, "*")) srv_name_mask = ""; --- 533,537 ---- irc_settime(const char *srv_name_mask, time_t new_time) { ! ioset_set_time(new_time); if (!strcmp(srv_name_mask, "*")) srv_name_mask = ""; *************** *** 788,808 **** /* If we have a reliable clock, we just keep our current time. */ } else { ! if (srv->boot < self->boot) { ! /* The other server is older than us. Accept their timestamp. */ self->boot = srv->boot; ! clock_skew = srv->link - (now - clock_skew); ! } else if (srv->boot > self->boot) { ! /* We are older. Use our own timestamp. */ ! } else { ! /* ircu dictates that the connected-to server's timestamp ! * is used if the boot times are the same. We will always ! * be connecting. */ ! self->boot = srv->boot; ! clock_skew = srv->link - (now - clock_skew); } } if (srv == self->uplink) { extern time_t burst_begin; ! burst_begin = now + clock_skew; } return 1; --- 788,802 ---- /* If we have a reliable clock, we just keep our current time. */ } else { ! if (srv->boot <= self->boot) { ! /* The other server is older than us. Accept their timestamp. ! * Alternately, we are same age, but we accept their time ! * since we are linking to them. */ self->boot = srv->boot; ! ioset_set_time(srv->link); } } if (srv == self->uplink) { extern time_t burst_begin; ! burst_begin = now; } return 1; |