File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -60,12 +60,13 @@ void SSLConnection::readCallback()
60
60
else if (_status == SSLStatus::Connected)
61
61
{
62
62
int rd;
63
- char buf[4096 ];
64
63
bool newDataFlag = false ;
64
+ size_t readLength;
65
65
do
66
66
{
67
-
68
- rd = SSL_read (_sslPtr.get (), buf, sizeof (buf));
67
+ _readBuffer.ensureWritableBytes (1024 );
68
+ readLength = _readBuffer.writableBytes ();
69
+ rd = SSL_read (_sslPtr.get (), _readBuffer.beginWrite (), readLength);
69
70
LOG_TRACE << " ssl read:" << rd << " bytes" ;
70
71
int sslerr = SSL_get_error (_sslPtr.get (), rd);
71
72
if (rd <= 0 && sslerr != SSL_ERROR_WANT_READ)
@@ -77,11 +78,10 @@ void SSLConnection::readCallback()
77
78
}
78
79
if (rd > 0 )
79
80
{
80
- _readBuffer.append (buf, rd);
81
+ _readBuffer.hasWritten ( rd);
81
82
newDataFlag = true ;
82
83
}
83
-
84
- } while (rd == sizeof (buf));
84
+ } while ((size_t )rd == readLength);
85
85
if (newDataFlag)
86
86
{
87
87
// eval callback function;
@@ -131,7 +131,7 @@ void SSLConnection::doHandshaking()
131
131
_ioChannelPtr->disableWriting ();
132
132
}
133
133
else
134
- { // 错误
134
+ {
135
135
// ERR_print_errors(err);
136
136
LOG_FATAL << " SSL handshake err" ;
137
137
_ioChannelPtr->disableReading ();
You can’t perform that action at this time.
0 commit comments