fix disconnect from peer
[spider.git] / perl / Msg.pm
index 52f0efd477aefbee6d622f0c708d92875b31eeca..60906c5964df83b0e547cd28628caaafefdf149c 100644 (file)
@@ -61,11 +61,12 @@ sub set_error
        $conn->{eproc} = $callback;
 }
 
-sub set_eof
+sub set_on_eof
 {
        my $conn = shift;
        my $callback = shift;
-       $conn->{sock}->on_eof(sub {$callback});
+       $conn->{sock}->on_eof($callback);
+       $conn->{sock}->on_error($callback);
 }
 
 sub set_rproc
@@ -141,7 +142,7 @@ sub connect {
 
                connect => [$to_host, $to_port],
 
-#              on_connect => sub {my $h = shift; $conn->{peerhost} = $h->handle->peername;},
+               on_connect => sub {my $h = shift; $conn->{peerhost} = shift;},
 
                on_eof => sub {$conn->disconnect},