0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::net: Increase the peek workaround buffer size.

This commit is contained in:
Jason Volk 2019-09-13 11:49:49 -07:00
parent 27dbc14b3a
commit fcf19bc002

View file

@ -3102,9 +3102,9 @@ try
// the wait. ASIO should fix this by adding a ssl::stream.wait() method // the wait. ASIO should fix this by adding a ssl::stream.wait() method
// which will bail out immediately in this case before passing up to the // which will bail out immediately in this case before passing up to the
// real socket wait. // real socket wait.
static char buf[1]; static char buf[64];
static const ilist<mutable_buffer> bufs{buf}; static const ilist<mutable_buffer> bufs{buf};
if(SSL_peek(ssl.native_handle(), buf, sizeof(buf)) >= ssize_t(sizeof(buf))) if(SSL_peek(ssl.native_handle(), buf, sizeof(buf)) > 0)
{ {
ircd::post(desc[1], [handle(std::move(handle))] ircd::post(desc[1], [handle(std::move(handle))]
{ {
@ -3148,11 +3148,8 @@ ircd::net::socket::check(std::nothrow_t,
const ready &type) const ready &type)
noexcept noexcept
{ {
assert(type == ready::ERROR); static char buf[64];
static const ilist<mutable_buffer> bufs
static char buf[1];
static const ilist<mutable_buffer> bufs{buf};
static const std::error_code eof
{ {
buf buf
}; };
@ -3161,12 +3158,12 @@ noexcept
return make_error_code(std::errc::bad_file_descriptor); return make_error_code(std::errc::bad_file_descriptor);
std::error_code ret; std::error_code ret;
if(SSL_peek(ssl.native_handle(), buf, sizeof(buf)) >= ssize_t(sizeof(buf))) if(SSL_peek(ssl.native_handle(), buf, sizeof(buf)) > 0)
return ret; return ret;
assert(!blocking(*this)); assert(!blocking(*this));
boost::system::error_code ec; boost::system::error_code ec;
if(sd.receive(bufs, sd.message_peek, ec) >= ssize_t(sizeof(buf))) if(sd.receive(bufs, sd.message_peek, ec) > 0)
{ {
assert(!ec.value()); assert(!ec.value());
return ret; return ret;