projects
/
spider.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f84fd50
)
add a timeout to the outgoing connect
author
minima
<minima>
Sun, 4 Mar 2001 13:41:21 +0000
(13:41 +0000)
committer
minima
<minima>
Sun, 4 Mar 2001 13:41:21 +0000
(13:41 +0000)
perl/Msg.pm
patch
|
blob
|
history
diff --git
a/perl/Msg.pm
b/perl/Msg.pm
index 1099ba8804f881106e918c699798a3b233810868..6702f152bc6811334a8cf1f6661791f0d0a2c7b7 100644
(file)
--- a/
perl/Msg.pm
+++ b/
perl/Msg.pm
@@
-51,6
+51,7
@@
sub new
state => 0,
lineend => "\r\n",
csort => 'telnet',
state => 0,
lineend => "\r\n",
csort => 'telnet',
+ timeval => 60,
};
return bless $conn, $class;
};
return bless $conn, $class;
@@
-61,20
+62,22
@@
sub new
sub connect {
my ($pkg, $to_host, $to_port, $rproc) = @_;
sub connect {
my ($pkg, $to_host, $to_port, $rproc) = @_;
+ # Create a connection end-point object
+ my $conn = $pkg;
+ unless (ref $pkg) {
+ $conn = $pkg->new($rproc);
+ }
+
# Create a new internet socket
my $sock = IO::Socket::INET->new (
PeerAddr => $to_host,
PeerPort => $to_port,
Proto => 'tcp',
# Create a new internet socket
my $sock = IO::Socket::INET->new (
PeerAddr => $to_host,
PeerPort => $to_port,
Proto => 'tcp',
- Reuse => 1);
+ Reuse => 1,
+ Timeout => $conn->{timeval} / 2);
return undef unless $sock;
return undef unless $sock;
- # Create a connection end-point object
- my $conn = $pkg;
- unless (ref $pkg) {
- $conn = $pkg->new($rproc);
- }
$conn->{sock} = $sock;
if ($conn->{rproc}) {
$conn->{sock} = $sock;
if ($conn->{rproc}) {