Set SO_LINGER = 0 on all client sockets
authorminima <minima>
Thu, 10 Jan 2002 17:26:22 +0000 (17:26 +0000)
committerminima <minima>
Thu, 10 Jan 2002 17:26:22 +0000 (17:26 +0000)
Changes
TODO
perl/ExtMsg.pm
perl/Msg.pm

diff --git a/Changes b/Changes
index e1685aaf6addc69638eb38dfe79363eb34098e25..4720a69ecc83d680c028464075134d1f26e9ffe5 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+10Jan02=======================================================================
+1. set SO_LINGER = 0 to try to prevent the system sending data on a closing
+socket. This MAY help some of the hanging problems.
 08Jan02=======================================================================
 1. altered sh/qrz to point to the new server
 2. alter the character set handling a bit to make it better for spanish
diff --git a/TODO b/TODO
index 1a5b9021cef5fbd047fb03274ea0fa98a3ac72d6..e3821e2924368f1418bad71e5ead10ca677f8464 100644 (file)
--- a/TODO
+++ b/TODO
@@ -14,6 +14,7 @@ Maintenance and Enhancements
 * write a parallel event driven system for helper routines
 * handle distros in announces
 * check set/homenode et al input for proper callsigns
+* filter names and stuff so that it doesn't cause bad syntax in user_asc
 
 New Protocol Stuff
 ------------------
index 8e17cfa875c251dbb2c850bc4d636bd48b2fffe0..2edd7537962a91bd06371f0805eaef841b27aedf 100644 (file)
@@ -152,6 +152,7 @@ sub to_connected
        delete $conn->{cmd};
        $conn->{timeout}->del if $conn->{timeout};
        delete $conn->{timeout};
+       $conn->nolinger;
        &{$conn->{rproc}}($conn, "$dir$call|$sort");
        $conn->_send_file("$main::data/connected") unless $conn->{outgoing};
 }
@@ -162,6 +163,7 @@ sub new_client {
        if ($sock) {
                my $conn = $server_conn->new($server_conn->{rproc});
                $conn->{sock} = $sock;
+               $conn->nolinger;
                Msg::blocking($sock, 0);
                $conn->{blocking} = 0;
                eval {$conn->{peerhost} = $sock->peerhost};
index cdb72aa0e920e41433c8ab724d58b41c1719b8b1..15dc26d4ff29fe85e0b56ec665655babb284c256 100644 (file)
@@ -208,10 +208,6 @@ sub disconnect {
        $call ||= 'unallocated';
        dbg("Connection $conn->{cnum} $call disconnected") if isdbg('connll');
        
-       unless ($main::is_win) {
-               kill 'TERM', $conn->{pid} if exists $conn->{pid};
-       }
-
        # get rid of any references
        for (keys %$conn) {
                if (ref($conn->{$_})) {
@@ -219,10 +215,16 @@ sub disconnect {
                }
        }
 
-       return unless defined($sock);
-    set_event_handler ($sock, read => undef, write => undef, error => undef);
-    shutdown($sock, 3);
-       close($sock);
+       if (defined($sock)) {
+               set_event_handler ($sock, read => undef, write => undef, error => undef);
+               shutdown($sock, 3);
+               close($sock);
+       }
+       
+       unless ($main::is_win) {
+               kill 'TERM', $conn->{pid} if exists $conn->{pid};
+       }
+
 }
 
 sub send_now {
@@ -354,6 +356,12 @@ sub new_server {
        return $self;
 }
 
+sub nolinger
+{
+       my $conn = shift;
+       setsockopt($conn->{sock}, SOL_SOCKET, SO_LINGER, pack("ll", 0, 0)) or confess "setsockopt: $!";
+}
+
 sub dequeue
 {
        my $conn = shift;
@@ -436,6 +444,7 @@ sub new_client {
                my $conn = $server_conn->new($server_conn->{rproc});
                $conn->{sock} = $sock;
                blocking($sock, 0);
+               $conn->nolinger;
                $conn->{blocking} = 0;
                my ($rproc, $eproc) = &{$server_conn->{rproc}} ($conn, $conn->{peerhost} = $sock->peerhost(), $conn->{peerport} = $sock->peerport());
                $conn->{sort} = 'Incoming';