From: djk Date: Wed, 3 May 2000 13:34:18 +0000 (+0000) Subject: 1. put some extra checks and balances in to message send routine in Msg.pm to X-Git-Tag: R_1_40~17 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=cace76c5873d6d58c4db43d5eb9b3d2e4107428f;p=spider.git 1. put some extra checks and balances in to message send routine in Msg.pm to see if I can prevent the error seen by Arnold (which I think is only likely to appear in heavily loaded sites). --- diff --git a/Changes b/Changes index 5b9060d0..c56dfd4c 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +30Apr00======================================================================= +1. put some extra checks and balances in to message send routine in Msg.pm to +see if I can prevent the error seen by Arnold (which I think is only likely to +appear in heavily loaded sites). 25Apr00======================================================================= 1. Changed reply so that you can reply to more than one address privately 31Mar00======================================================================= diff --git a/perl/Msg.pm b/perl/Msg.pm index 9df7640e..33a0af80 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -110,9 +110,11 @@ sub _send { while (@$rq) { my $msg = $rq->[0]; - my $bytes_to_write = length($msg) - $offset; + my $mlth = length($msg); + my $bytes_to_write = $mlth - $offset; my $bytes_written = 0; - while ($bytes_to_write) { + confess("Negative Length! msg: '$msg' lth: $mlth offset: $offset") if $bytes_to_write < 0; + while ($bytes_to_write > 0) { $bytes_written = syswrite ($sock, $msg, $bytes_to_write, $offset); if (!defined($bytes_written)) { @@ -124,6 +126,7 @@ sub _send { # be called back eventually, and will resume sending return 1; } else { # Uh, oh + delete $conn->{send_offset}; $conn->handle_send_err($!); return 0; # fail. Message remains in queue .. }