[Spread-users] Spread Perl module - fix select error code

Matt Sergeant matt at sergeant.org
Thu Aug 11 09:54:23 EDT 2005


Normally in spread if you get a timeout you want to go around the loop 
again and keep trying to receive() a message. This results in code like 
this:

while (1) {
     my ($srv_type, $sdr, $grps, $m_type, $end, $msg) = 
Spread::receive($mbox, 1);
     next if $Spread::sperror == 3; # timeout
     die "receive: $Spread::sperror" if $Spread::sperror;
     ...
}

Unfortunately if the internal select() call fails for some reason this 
(rather catastrophically if this is on a server) can cause an infinite 
loop.

This is because the XS code assumes all non-positive returns from 
select() mean timeout.

I'm surprised this hasn't been patched before, but here is a fix (let 
me know if Mail.app screws up the attachment formatting and I'll gzip 
it).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: spread_select.patch
Type: application/octet-stream
Size: 1106 bytes
Desc: not available
Url : http://lists.spread.org/pipermail/spread-users/attachments/20050811/b182375a/attachment.obj 


More information about the Spread-users mailing list