]> jfr.im git - irc/ircd-hybrid/bopm.git/commitdiff
Added byte counter to teach connection, and adjusted manual check output to be be...
authorstrtok <redacted>
Wed, 13 Feb 2002 22:15:28 +0000 (22:15 +0000)
committerstrtok <redacted>
Wed, 13 Feb 2002 22:15:28 +0000 (22:15 +0000)
scan.c
scan.h

diff --git a/scan.c b/scan.c
index 9fb716ba5f861ebbfdf401c383138618f2adf606..a7a23b1299bc4b0ac98446ab2bbe592b2200898d 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -129,6 +129,7 @@ void scan_connect(char *addr, char *irc_addr, char *irc_nick,
             newconn->irc_nick = strdup(irc_nick);
             newconn->irc_user = strdup(irc_user);
            newconn->verbose = verbose;
+            newconn->bytes_read = 0; 
                  
            if(conn_notice)
               newconn->conn_notice = strdup(conn_notice);
@@ -393,10 +394,10 @@ void scan_negfail(scan_struct *conn)
       */
       if(conn->verbose)
        {
-          irc_send("PRIVMSG %s :%s (%d): Negotiation "
-                   "to %s failed.", CONF_CHANNELS,
-                   conn->protocol->type,
-                   conn->protocol->port, conn->irc_addr);
+             irc_send("PRIVMSG %s :%s (%d): Connection "
+                      "to %s closed, negotiation failed (%d bytes read)", CONF_CHANNELS,
+                      conn->protocol->type,
+                      conn->protocol->port, conn->irc_addr, conn->bytes_read);
        }
        conn->state = STATE_CLOSED;
 }
@@ -419,6 +420,7 @@ void scan_readready(scan_struct *conn)
                           return;
 
                    default:
+                          conn->bytes_read++;
                           if(c == 0 || c == '\r')
                                continue;
                           
@@ -623,8 +625,14 @@ void scan_timer()
             {
                 if(ss->verbose && (ss->state != STATE_CLOSED))
                  {
-                         irc_send("PRIVMSG %s :%s (%d): Connection "
-                                        "to %s timed out.", CONF_CHANNELS,
+                      if(ss->bytes_read)
+                         irc_send("PRIVMSG %s :%s (%d): Negotiation "
+                                        "to %s timed out (%d bytes read).", CONF_CHANNELS,
+                                        ss->protocol->type,
+                                        ss->protocol->port, ss->irc_addr, ss->bytes_read);
+                      else
+                         irc_send("PRIVMSG %s :%s (%d): Negotiation "
+                                        "to %s timed out (No response).", CONF_CHANNELS,
                                         ss->protocol->type,
                                         ss->protocol->port, ss->irc_addr);
                  }
diff --git a/scan.h b/scan.h
index 4aef0c8ed391efa10d9e123ea55ddf0ba10f1d73..f0b4beb3c62e102debe7ca42fedd78cb55a9a9f4 100644 (file)
--- a/scan.h
+++ b/scan.h
@@ -36,6 +36,7 @@
           struct sockaddr_in sockaddr; /* holds information about remote host for socket() */
           time_t create_time;          /* Creation time, for timeout                       */         
           int state;                   /* Status of scan                                   */
+          unsigned int bytes_read;          /* Number of bytes received                         */
           protocol_hash *protocol;     /* Pointer to protocol type                         */
          int verbose;                 /* report progress to channel verbosely?            */
      };