Rx: Remove conn_call_lock contention between rx_NewCall and rx_EndCall
[openafs.git] / src / rxdebug / rxdebug.c
index 8ebd6c2..da5ffd6 100644 (file)
 #endif
 #include <string.h>
 #include <sys/stat.h>
+#include <afs/afsutil.h>
 #include <afs/stds.h>
 #include <afs/cmd.h>
 
 #include <stdio.h>
 
-#include "rx_user.h"
-#include "rx_clock.h"
-#include "rx_queue.h"
-#include "rx.h"
-#include "rx_globals.h"
+#include <rx/rx_user.h>
+#include <rx/rx_clock.h>
+#include <rx/rx_queue.h>
+#include <rx/rx.h>
+#include <rx/rx_globals.h>
 
 
 #define        TIMEOUT     20
 
-extern struct hostent *hostutil_GetHostByName();
-
 static short
-PortNumber(aport)
-     register char *aport;
+PortNumber(char *aport)
 {
     register int tc;
     register short total;
 
     total = 0;
-    while (tc = *aport++) {
+    while ((tc = *aport++)) {
        if (tc < '0' || tc > '9')
            return -1;          /* bad port number */
        total *= 10;
@@ -66,8 +64,7 @@ PortNumber(aport)
 }
 
 static short
-PortName(aname)
-     register char *aname;
+PortName(char *aname)
 {
     register struct servent *ts;
     ts = getservbyname(aname, NULL);
@@ -281,19 +278,21 @@ MainCommand(struct cmd_syndesc *as, void *arock)
            fprintf(stderr,
                    "WARNING: Server doesn't support retrieval of Rx statistics\n");
        } else {
-           struct rx_statistics rxstats;
+           union {
+               struct rx_statistics rxstats;
+               struct rx_debugIn debug;
+           } packet;
 
            /* should gracefully handle the case where rx_stats grows */
            code =
-               rx_GetServerStats(s, host, port, &rxstats,
+               rx_GetServerStats(s, host, port, &packet.rxstats,
                                  &supportedStatValues);
            if (code < 0) {
                printf("rxstats call failed with code %d\n", code);
                exit(1);
            }
-           if (code != sizeof(rxstats)) {
-               if ((((struct rx_debugIn *)(&rxstats))->type ==
-                    RX_DEBUGI_BADTYPE))
+           if (code != sizeof(packet.rxstats)) {
+               if (packet.debug.type == RX_DEBUGI_BADTYPE)
                    goto noRxStats;
                printf
                    ("WARNING: returned Rx statistics of unexpected size (got %d)\n",
@@ -301,7 +300,7 @@ MainCommand(struct cmd_syndesc *as, void *arock)
                /* handle other versions?... */
            }
 
-           rx_PrintTheseStats(stdout, &rxstats, sizeof(rxstats),
+           rx_PrintTheseStats(stdout, &packet.rxstats, sizeof(packet.rxstats),
                               tstats.nFreePackets, tstats.version);
        }
     }
@@ -498,6 +497,8 @@ MainCommand(struct cmd_syndesc *as, void *arock)
                    printf("dally, ");
                else if (tconn.callState[j] == RX_STATE_HOLD)
                    printf("hold, ");
+               else if (tconn.callState[j] == RX_STATE_RESET)
+                   printf("reset, ");
                printf("mode: ");
                if (tconn.callMode[j] == RX_MODE_SENDING)
                    printf("sending");
@@ -593,9 +594,7 @@ MainCommand(struct cmd_syndesc *as, void *arock)
 #include "AFS_component_version_number.c"
 #endif
 int
-main(argc, argv)
-     int argc;
-     char **argv;
+main(int argc, char **argv)
 {
     struct cmd_syndesc *ts;