Re: Trying to get beacon 1.1-0 working


Hi, Mitch,

> We're looking into this now.  We'll keep you posted on what we
> find out, and if/when we have a patch available.
>
> Thanks for your report!

I now think I have more proper fix for this problem, and the good
news is that it is a server-side-only fix.  The start of my
receive_tcp_report() function (again, based on 1.1-0 sources) now
looks like this:


    # As long as there's data pending on the connection
    while (@ready = $select->can_read(1)) {
      NEXTFH:
	foreach $fh (@ready) {
	    if($fh == $server) {
		# Create a new socket
		$newsock = $server->accept;

		$select->add($newsock);
	    }
	    else {
		if (eof($fh)) {
		    undef(@{$lines{$fh}});
		    $select->remove($fh);
		    close($fh);
		    next;
		} 
		while(defined($line = <$fh>) && ($line ne $ENDMESSAGE)) {
		    if (!defined($lines{$fh})) {
			@{$lines{$fh}} = ();
		    }
		    push(@{$lines{$fh}}, $line);
		}
		if (!defined($line)) {
		    if ($DEBUG>4) {
			printf("Incomplete message, %d lines collected\n",
			       scalar(@{$lines{$fh}}));
		    }
		    next NEXTFH; # incomplete message, collect more later
		}

		# Here we have $line eq $ENDMESSAGE, i.e. a complete message
		# has been collected, so proceed to process it
		@lines = @{$lines{$fh}};
		undef(@{$lines{$fh}});

		if ($DEBUG>4) {
		    printf("Processing %d lines\n", scalar(@lines));
		}

		# "scalar(@lines) is just the length of @lines -- Ie,
		# loop for all lines in the array.
		my $ii=0;   # Simple linecounter for receiving report       
		while ($ii < scalar(@lines)) {

Additionally, you need a global declaration of the %lines hash.

Regards,

- Håvard



Other Mailing lists | Author Index | Date Index | Subject Index | Thread Index