From: minima Date: Mon, 14 May 2001 17:26:17 +0000 (+0000) Subject: try to prevent double connects from semi succeeding and then getting an X-Git-Tag: OLDROUTE_1_48~18 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=8cdf937edf493134e69b2df1ec689839148f2d8f;p=spider.git try to prevent double connects from semi succeeding and then getting an abort from DXChannel->new --- diff --git a/Changes b/Changes index 21ab3c66..f6c0c42f 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ 14May01======================================================================= 1. fix problem with re-reading in db definitions for remote databases. +2. try to prevent situations where two can (semi) successfully login, probably +under load, and get a 'tried to connect whilst already connected' abort. 11May01======================================================================= 1. allow stat/msg on priv 1 07May01======================================================================= diff --git a/perl/Msg.pm b/perl/Msg.pm index ae9c4c28..8be2fc1b 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -398,7 +398,9 @@ FINISH: &{$conn->{eproc}}($conn, $!) if exists $conn->{eproc}; $conn->disconnect; } else { - $conn->dequeue if exists $conn->{msg}; + unless ($conn->{disable_read}) { + $conn->dequeue if exists $conn->{msg}; + } } } @@ -444,6 +446,13 @@ sub close_all_clients } } +sub disable_read +{ + my $conn = shift; + set_event_handler ($conn->{sock}, read => undef); + return $_[0] ? $conn->{disable_read} = $_[0] : $_[0]; +} + # #---------------------------------------------------- # Event loop routines used by both client and server diff --git a/perl/cluster.pl b/perl/cluster.pl index 98fdbb18..d321cba5 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -110,7 +110,8 @@ $starttime = 0; # the starting time of the cluster sub already_conn { my ($conn, $call, $mess) = @_; - + + $conn->disable_read(1); dbg('chan', "-> D $call $mess\n"); $conn->send_now("D$call|$mess"); sleep(2);