my ($conn, $msg) = @_;
# prepend length (encoded as network long)
my $len = length($msg);
- $msg =~ s/(\x00-\x2f\x7e-\xff%])/sprintf("%%%02X", ord($1))/eg;
+ $msg =~ s/([\%\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/eg;
push (@{$conn->{queue}}, $msg . "\n");
}
} else { # Uh, oh
delete $conn->{send_offset};
$conn->handle_send_err($!);
+ $conn->disconnect;
return 0; # fail. Message remains in queue ..
}
}
}
FINISH:
- if (defined $bytes_read == 0) {
- $conn->disconnect();
+ if (defined $bytes_read && $bytes_read == 0) {
+# $conn->disconnect();
&{$conn->{rcvd_notification_proc}}($conn, undef, $!);
+ @lines = ();
}
while (@lines){