Rewrote the socket engine. This should fix random timeouts.

This commit is contained in:
Elijah Perrault committed 2011-02-02 20:49:19 -07:00
1 parent ccad64635e
commit f7481bc0fa
2 files changed
+16 -5

No files matched your search

+15 -5
View File
@@ -324,20 +324,30 @@ while (1) {
$sockid = $_ if ($SOCKET{$_} eq $sock); $sockid = $_ if ($SOCKET{$_} eq $sock);
} }
# Read the data. # Read the data.
my $data = readline($sock); my $idata;
if (!defined $data) { recv($sock, $idata, POSIX::BUFSIZ, 0);
# Check for the data.
if (!defined $idata || length($idata) == 0) {
# Got EOF, close socket # Got EOF, close socket
err(2, "Lost connection to $sockid!", 0); err(2, "Lost connection to $sockid!", 0);
$SELECT->remove($sock); $SELECT->remove($sock);
next; next;
} }
# Read the buffer.
my $data .= $idata;
while ($data =~ s/(.*\n)//) {
my $line = $1;
# Remove the newlines. # Remove the newlines.
chomp $data; chomp $line;
# Debug. # Debug.
dbug $sockid." >> ".$data; dbug $sockid." >> ".$line;
# Parse data. # Parse data.
Parser::IRC::ircparse($sockid, $data); Parser::IRC::ircparse($sockid, $line);
}
} }
} }
+1
View File
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev 3.0 Indev
================================================================== ==================================================================
* Rewrote the socket engine. This should fix random timeouts.
* Added IsItUp module. * Added IsItUp module.
* Added user:net for network-specific user blocks. * Added user:net for network-specific user blocks.
* Bug fix: Fixed broken no-parameter config blocks. * Bug fix: Fixed broken no-parameter config blocks.