From: Michael Poole Date: Wed, 5 Apr 2006 00:09:48 +0000 (+0000) Subject: Correctly implement AsLL pong. X-Git-Tag: v1.4.0-rc1~151 X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=46a83ccaf7c031c84ea50138d1ebf60c10515dd1 Correctly implement AsLL pong. src/proto-p10.c (irc_pong_asll): New function. (cmd_ping): Use it. git-archimport-id: srvx@srvx.net--2006/srvx--devo--1.3--patch-5 --- diff --git a/ChangeLog b/ChangeLog index ee4db90..973a4e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,20 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3 # +2006-04-05 00:09:48 GMT Michael Poole patch-5 + + Summary: + Correctly implement AsLL pong. + Revision: + srvx--devo--1.3--patch-5 + + src/proto-p10.c (irc_pong_asll): New function. + (cmd_ping): Use it. + + modified files: + ChangeLog src/proto-p10.c + + 2006-04-05 00:08:04 GMT Michael Poole patch-4 Summary: diff --git a/src/proto-p10.c b/src/proto-p10.c index c7d69b0..d44d8a2 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -596,6 +596,21 @@ irc_pong(const char *who, const char *data) putsock("%s " P10_PONG " %s :%s", self->numeric, who, data); } +void +irc_pong_asll(const char *who, const char *orig_ts) +{ + char *delim; + struct timeval orig; + struct timeval now; + int diff; + + orig.tv_sec = strtoul(orig_ts, &delim, 10); + orig.tv_usec = (*delim == '.') ? strtoul(delim + 1, NULL, 10) : 0; + gettimeofday(&now, NULL); + diff = (now.tv_sec - orig.tv_sec) * 1000 + (now.tv_usec - orig.tv_usec) / 1000; + putsock("%s " P10_PONG " %s %s %d " FMT_TIME_T ".%06u", self->numeric, who, orig_ts, diff, now.tv_sec, (unsigned)now.tv_usec); +} + void irc_pass(const char *passwd) { @@ -957,8 +972,8 @@ static CMD_FUNC(cmd_ping) struct server *srv; struct userNode *un; - if(argc > 3) - irc_pong(argv[2], argv[1]); + if (argc > 3) + irc_pong_asll(argv[2], argv[3]); else if ((srv = GetServerH(origin))) irc_pong(self->name, srv->numeric); else if ((un = GetUserH(origin)))