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

Delta Between Two Patch Sets: lib/DJabberd/Connection.pm

Issue 2341: avoid ssl_eof error on SSL_WANT_READ and friends SVN Base: http://code.sixapart.com/svn/djabberd/trunk/DJabberd
Left Patch Set: Created 1 year, 4 months ago
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 package DJabberd::Connection; 1 package DJabberd::Connection;
2 use strict; 2 use strict;
3 use warnings; 3 use warnings;
4 use base 'Danga::Socket'; 4 use base 'Danga::Socket';
5 use bytes; 5 use bytes;
6 use fields ( 6 use fields (
7 'saxhandler', 7 'saxhandler',
8 'parser', 8 'parser',
9 9
10 'bound_jid', # undef until resource binding - then DJabberd::JI D object 10 'bound_jid', # undef until resource binding - then DJabberd::JI D object
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 return; 485 return;
486 } 486 }
487 487
488 # Net::SSLeays buffers internally, so if we didn't read anything, it's 488 # Net::SSLeays buffers internally, so if we didn't read anything, it's
489 # in its buffer 489 # in its buffer
490 unless ($data && length $data) { 490 unless ($data && length $data) {
491 # a few of these in a row implies an EOF. else it could 491 # a few of these in a row implies an EOF. else it could
492 # just be the underlying socket was readable, but there 492 # just be the underlying socket was readable, but there
493 # wasn't enough of an SSL packet for OpenSSL/etc to return 493 # wasn't enough of an SSL packet for OpenSSL/etc to return
494 # any unencrypted data back to us. 494 # any unencrypted data back to us.
495 # A call to 'should_we_close_on_zero_bytes' accounts for the possibi lity 495 # We call 'actual_error_on_empty_read' to avoid counting
496 # of recieving SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE 496 # SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE as 'actual' errors
497 my $err = DJabberd::Stanza::StartTLS->should_we_close_on_zero_bytes( $ssl); 497 my $err = DJabberd::Stanza::StartTLS->actual_error_on_empty_read($ss l);
498 if($err && ++$self->{'ssl_empty_read_ct'} >= 10) { 498 if($err && ++$self->{'ssl_empty_read_ct'} >= 10) {
499 $self->log->warn("SSL Read error: $err (assuming ssl_eof)"); 499 $self->log->warn("SSL Read error: $err (assuming ssl_eof)");
500 $self->close('ssl_eof'); 500 $self->close('ssl_eof');
501 } 501 }
502 return; 502 return;
503 } 503 }
504 $self->{'ssl_empty_read_ct'} = 0; 504 $self->{'ssl_empty_read_ct'} = 0;
505 $bref = \$data; 505 $bref = \$data;
506 } else { 506 } else {
507 # non-ssl mode: 507 # non-ssl mode:
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 sub event_hup { my $self = shift; $self->close; } 798 sub event_hup { my $self = shift; $self->close; }
799 799
800 800
801 # Local Variables: 801 # Local Variables:
802 # mode: perl 802 # mode: perl
803 # c-basic-indent: 4 803 # c-basic-indent: 4
804 # indent-tabs-mode: nil 804 # indent-tabs-mode: nil
805 # End: 805 # End:
806 806
807 1; 807 1;
LEFTRIGHT

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