Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(38)

Unified Diff: lib/DJabberd/Stanza/StartTLS.pm

Issue 2341: avoid ssl_eof error on SSL_WANT_READ and friends SVN Base: http://code.sixapart.com/svn/djabberd/trunk/DJabberd
Patch Set: response to comments Created 1 year, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side by-side-diff with in-line comments
Download patch
Index: lib/DJabberd/Stanza/StartTLS.pm
===================================================================
--- lib/DJabberd/Stanza/StartTLS.pm (revision 774)
+++ lib/DJabberd/Stanza/StartTLS.pm (working copy)
@@ -9,6 +9,8 @@
use constant SSL_ERROR_WANT_READ => 2;
use constant SSL_ERROR_WANT_WRITE => 3;
+use constant SSL_ERROR_WANT_CONNECT => 4;
+use constant SSL_ERROR_WANT_ACCEPT => 5;
sub on_recv_from_server { &process }
sub on_recv_from_client { &process }
@@ -67,6 +69,23 @@
$conn->set_writer_func(DJabberd::Stanza::StartTLS->danga_socket_writerfunc($conn));
}
+sub actual_error_on_empty_read {
+ my ($class, $ssl) = @_;
+ my $err = Net::SSLeay::get_error($ssl, -1);
+ if ($err == SSL_ERROR_WANT_READ ||
+ $err == SSL_ERROR_WANT_WRITE ||
+ $err == SSL_ERROR_WANT_CONNECT ||
+ $err == SSL_ERROR_WANT_ACCEPT) {
+ # Not an actual error, SSL is busy doing something like renegotiating encryption
+ # just try again next time
+ return 0;
+ }
+ # This is actually an error (return the SSL err code)
+ # unlike the 'no-op' WANT_READ and WANT_WRITE
+ return $err;
+}
+
+
sub danga_socket_writerfunc {
my ($class, $conn) = @_;
my $ssl = $conn->{ssl};
« lib/DJabberd/Connection.pm ('k') | no next file »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r483