X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FMsg.pm;h=9df7640ecbbfbfecd5a80493469a5abacb1700f5;hb=f686f4454acf8431eca458918c7caeb385a9c9e3;hp=7114eba8b9eea3ad3e9133d921f162694fbb824b;hpb=2e16209416d1d189707935868a708b525c93097b;p=spider.git diff --git a/perl/Msg.pm b/perl/Msg.pm index 7114eba8..9df7640e 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -5,6 +5,9 @@ # # I have modified it to suit my devious purposes (Dirk Koopman G1TLH) # +# $Id$ +# + package Msg; require Exporter; @@ -64,7 +67,8 @@ sub disconnect { my $sock = delete $conn->{sock}; return unless defined($sock); set_event_handler ($sock, "read" => undef, "write" => undef); - close($sock); + shutdown($sock, 3); + close($sock); } sub send_now { @@ -162,6 +166,7 @@ sub set_blocking { fcntl ($_[0], F_SETFL(), $flags); } } + sub handle_send_err { # For more meaningful handling of send errors, subclass Msg and # rebless $conn. @@ -274,6 +279,13 @@ sub _new_client { } } +sub close_server +{ + set_event_handler ($main_socket, "read" => undef); + $main_socket->close; + $main_socket = 0; +} + #---------------------------------------------------- # Event loop routines used by both client and server