From 6d4734fbc4db9f84db74e9ffd8f81cd019f6c8ea Mon Sep 17 00:00:00 2001 From: minima Date: Thu, 10 Jan 2002 17:26:22 +0000 Subject: [PATCH] Set SO_LINGER = 0 on all client sockets --- Changes | 3 +++ TODO | 1 + perl/ExtMsg.pm | 2 ++ perl/Msg.pm | 25 +++++++++++++++++-------- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Changes b/Changes index e1685aaf..4720a69e 100644 --- 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 1a5b9021..e3821e29 100644 --- 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 ------------------ diff --git a/perl/ExtMsg.pm b/perl/ExtMsg.pm index 8e17cfa8..2edd7537 100644 --- a/perl/ExtMsg.pm +++ b/perl/ExtMsg.pm @@ -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}; diff --git a/perl/Msg.pm b/perl/Msg.pm index cdb72aa0..15dc26d4 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -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'; -- 2.34.1