add first take on IP address remembering
[spider.git] / perl / Msg.pm
index 4400fe8d76482050f5d8974b599a6fcdeed55559..09b0e634e6fc28c6f81ff4faac933e734ceb5109 100644 (file)
@@ -29,6 +29,7 @@ $now = time;
 $cnum = 0;
 $connect_timeout = 5;
 $disc_waittime = 1.5;
+%conns;
 
 our %delqueue;
 
@@ -102,6 +103,12 @@ sub conns
        return $ref;
 }
 
+# this is called as a FUNCTION i.e my $conn = Msg::get($call);
+sub get
+{
+       return $conns{shift};
+}
+
 # this is only called by any dependent processes going away unexpectedly
 sub pid_gone
 {
@@ -279,7 +286,7 @@ sub disconnect
                if ($sock->{buffer}) {
                        my $lth = length $sock->{buffer};
                        Mojo::IOLoop->timer($disc_waittime, sub {
-                                                                       dbg("Buffer contained $lth data , coordinated for $disc_waittime secs, now disconnecting $call") if $dbg;
+                                                                       dbg("Buffer contained $lth characters, coordinated for $disc_waittime secs, now disconnecting $call") if $dbg;
                                                                        _close_it($conn);
                                                                });
                } else {