diff options
author | John Kohl <jtkohl@mit.edu> | 1989-10-27 07:33:34 +0000 |
---|---|---|
committer | John Kohl <jtkohl@mit.edu> | 1989-10-27 07:33:34 +0000 |
commit | 090b52ebae87eb02d1d98b41f55736cc3ecd022b (patch) | |
tree | f121ebdf55744fe3f83814057d6b8ca318d2c692 | |
parent | 7e8204a625d0bb0688cedf9fa3b58c84c25c25e4 (diff) |
add counters for old support
-rw-r--r-- | server/server.c | 63 |
1 files changed, 61 insertions, 2 deletions
diff --git a/server/server.c b/server/server.c index efc4a00..70d8958 100644 --- a/server/server.c +++ b/server/server.c @@ -15,7 +15,7 @@ #ifndef lint #ifndef SABER -static char rcsid_server_c[] = "$Header$"; +static char rcsid_server_c[] = "$Id$"; #endif SABER #endif lint @@ -98,6 +98,17 @@ int timo_dead = TIMO_DEAD; long srv_rexmit_secs = REXMIT_SECS; +/* counters to measure old protocol use */ +#ifdef OLD_COMPAT +int old_compat_count_uloc = 0; +int old_compat_count_ulocate = 0; +int old_compat_count_subscr = 0; +#endif /* OLD_COMPAT */ +#ifdef NEW_COMPAT +int new_compat_count_uloc = 0; +int new_compat_count_subscr = 0; +#endif /* NEW_COMPAT */ + #ifdef DEBUG extern int zalone; #endif DEBUG @@ -905,8 +916,13 @@ struct sockaddr_in *who; char **responses; int num_resp; char *vers, *pkts, *upt; +#if defined(OLD_COMPAT) || defined(NEW_COMPAT) + int extrafields = 0; +#endif /* OLD_ or NEW_COMPAT */ #define NUM_FIXED 3 /* 3 fixed fields, plus server info */ - + /* well, not really...but for + backward compatibility, we gotta + do it this way. */ (void) strcpy(buf,version); (void) strcat(buf, "/"); #ifdef vax @@ -931,7 +947,21 @@ struct sockaddr_in *who; (void) sprintf(buf, "%d seconds operational",NOW - uptime); upt = strsave(buf); +#ifdef OLD_COMPAT + if (old_compat_count_uloc) extrafields++; + if (old_compat_count_ulocate) extrafields++; + if (old_compat_count_subscr) extrafields++; +#endif /* OLD_COMPAT */ +#ifdef NEW_COMPAT + if (new_compat_count_uloc) extrafields++; + if (new_compat_count_subscr) extrafields++; +#endif /* NEW_COMPAT */ +#if defined(OLD_COMPAT) || defined(NEW_COMPAT) + responses = (char **) xmalloc((NUM_FIXED + nservers + + extrafields) * sizeof(char **)); +#else responses = (char **) xmalloc((NUM_FIXED + nservers)*sizeof(char **)); +#endif /* OLD_ or NEW_COMPAT */ responses[0] = vers; responses[1] = pkts; responses[2] = upt; @@ -945,6 +975,35 @@ struct sockaddr_in *who; otherservers[i].zs_dumping ? " (DUMPING)" : ""); responses[num_resp++] = strsave(buf); } +#ifdef OLD_COMPAT + if (old_compat_count_uloc) { + (void) sprintf(buf, "%d old old location requests", + old_compat_count_uloc); + responses[num_resp++] = strsave(buf); + } + if (old_compat_count_ulocate) { + (void) sprintf(buf, "%d old old loc lookup requests", + old_compat_count_ulocate); + responses[num_resp++] = strsave(buf); + } + if (old_compat_count_subscr) { + (void) sprintf(buf, "%d old old subscr requests", + old_compat_count_subscr); + responses[num_resp++] = strsave(buf); + } +#endif /* OLD_COMPAT */ +#ifdef NEW_COMPAT + if (new_compat_count_uloc) { + (void) sprintf(buf, "%d new old location requests", + new_compat_count_uloc); + responses[num_resp++] = strsave(buf); + } + if (new_compat_count_subscr) { + (void) sprintf(buf, "%d new old subscr requests", + new_compat_count_subscr); + responses[num_resp++] = strsave(buf); + } +#endif /* NEW_COMPAT */ send_msg_list(who, ADMIN_STATUS, responses, num_resp, 0); for (i = 0; i < num_resp; i++) |