[Spread-users] bug?

Ivan Kolosovskiy agava-develop at yandex.ru
Wed Mar 30 06:23:59 EST 2005


Hello, spread-users.

  Sorry for bad english, it's not my native language.

  Problem:
  Computers A and B (FreeBSD, latest Spread) united in spread group.
  Computer A runs perl program, that generates messages in the Spread
  group. Computer B runs perl program, that listens to the Spread group
  and prints recieved messages. When Computer A sends a certain amount
  of messages(depends on message size), computer B recieved message,
  that computer A leaved group and computer B recieves error
  "Connection Closed".

computer A:
=========================
#!/usr/bin/perl
use strict;
use warnings;
use Spread;


my($service_type, $sender, $groups, $mess_type, $endian, $message);
my($messsize,$i,$c,$size,$ts);
$ts=0;
my($mailbox, $private_group) = Spread::connect(
               { spread_name => '4803 at vsemtest1.agava-guns.domain',
               private_name => 'vsem1', }
               );

        Spread::join($mailbox, 'LOG');

    Spread::multicast($mailbox, AGREED_MESS, 'LOG', 0, "Hey you!");


while (1) {
                for ( $i = 0; $i < 100; $i++) {
                        $size = Spread::multicast($mailbox, UNRELIABLE_MESS, 'LOG', 0, "BUUUU!BUUUU!BUUUU!BUUUU!");
                        print "Failed multicast: $sperrno\n!" unless $size;
                        $c++; $ts += $size;
                }
                sleep 1;
                while( not $messsize = Spread::poll($mailbox) ) {
                ($service_type, $sender, $groups, $mess_type, $endian, $message) =
               Spread::receive($mailbox);
                print" Service type: $service_type \n"
                ."Sender: $sender\nGroups: @{$groups}\n"
                ."Message type: $mess_type\nEndian: $endian\n"
                ."Message: $message\n\n";
                sleep 5;
                        die unless $size;
            }


                print "$c messages, $ts bytes sent\n";

}
================================

computer B:
=========================
#!/usr/bin/perl
use strict;
use warnings;
use Spread;


my($service_type, $sender, $groups, $mess_type, $endian, $message);
my($messsize);
 my($mailbox, $private_group) = Spread::connect(
               { spread_name => '4803 at vsemtest2.agava-guns.domain',
               private_name => 'vsem2', }
               );


        Spread::join($mailbox, 'LOG');

while(1) {
($messsize) = Spread::poll($mailbox);
        if(defined($messsize)) { print "Next message: $messsize bytes\n"; }
         else { print "Spread::poll $sperrno\n"; }
    if ($messsize > 0 ) {
        ($service_type, $sender, $groups, $mess_type, $endian, $message) =
               Spread::receive($mailbox);
        print" Service type: $service_type \n"
        ."Sender: $sender\nGroups: @{$groups}\n"
        ."Message type: $mess_type\nEndian: $endian\n"
        ."Message: $message\n\n";
    }
sleep 2 unless $messsize;
}
================================

  

-- 
С уважением,
 Ivan                          mailto:agava-develop at yandex.ru






More information about the Spread-users mailing list