Skip to content

Commit e3d2ebf

Browse files
committed
Modify the SSLConnection class
1 parent 9d1d6db commit e3d2ebf

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

trantor/net/ssl/SSLConnection.cc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,20 @@ void SSLConnection::readCallback()
6868
readLength = _readBuffer.writableBytes();
6969
rd = SSL_read(_sslPtr.get(), _readBuffer.beginWrite(), readLength);
7070
LOG_TRACE << "ssl read:" << rd << " bytes";
71-
int sslerr = SSL_get_error(_sslPtr.get(), rd);
72-
if (rd <= 0 && sslerr != SSL_ERROR_WANT_READ)
71+
if (rd <= 0)
7372
{
74-
LOG_TRACE << "ssl read err:" << sslerr;
75-
_status = SSLStatus::DisConnected;
76-
handleClose();
77-
return;
73+
int sslerr = SSL_get_error(_sslPtr.get(), rd);
74+
if (sslerr == SSL_ERROR_WANT_READ)
75+
{
76+
break;
77+
}
78+
else
79+
{
80+
LOG_TRACE << "ssl read err:" << sslerr;
81+
_status = SSLStatus::DisConnected;
82+
handleClose();
83+
return;
84+
}
7885
}
7986
if (rd > 0)
8087
{

0 commit comments

Comments
 (0)