Improve error logging.
This commit is contained in:
parent
097f3d42e1
commit
bed08625f0
@ -383,7 +383,13 @@ class SslStreamImpl {
|
|||||||
|
|
||||||
Result<size_t> write(Slice slice) {
|
Result<size_t> write(Slice slice) {
|
||||||
clear_openssl_errors("Before SslFd::write");
|
clear_openssl_errors("Before SslFd::write");
|
||||||
|
auto start_time = Time::now();
|
||||||
auto size = SSL_write(ssl_handle_.get(), slice.data(), static_cast<int>(slice.size()));
|
auto size = SSL_write(ssl_handle_.get(), slice.data(), static_cast<int>(slice.size()));
|
||||||
|
auto elapsed_time = Time::now() - start_time;
|
||||||
|
if (elapsed_time >= 0.001) {
|
||||||
|
LOG(ERROR) << "SSL_write of size " << slice.size() << " took " << elapsed_time << " seconds and returned " << size
|
||||||
|
<< ' ' << SSL_get_error(ssl_handle_.get(), size);
|
||||||
|
}
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
return process_ssl_error(size);
|
return process_ssl_error(size);
|
||||||
}
|
}
|
||||||
@ -395,8 +401,9 @@ class SslStreamImpl {
|
|||||||
auto start_time = Time::now();
|
auto start_time = Time::now();
|
||||||
auto size = SSL_read(ssl_handle_.get(), slice.data(), static_cast<int>(slice.size()));
|
auto size = SSL_read(ssl_handle_.get(), slice.data(), static_cast<int>(slice.size()));
|
||||||
auto elapsed_time = Time::now() - start_time;
|
auto elapsed_time = Time::now() - start_time;
|
||||||
if (elapsed_time >= 0.01) {
|
if (elapsed_time >= 0.001) {
|
||||||
LOG(ERROR) << "SSL_read took " << elapsed_time << " seconds and returned " << size;
|
LOG(ERROR) << "SSL_read took " << elapsed_time << " seconds and returned " << size << ' '
|
||||||
|
<< SSL_get_error(ssl_handle_.get(), size);
|
||||||
}
|
}
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
return process_ssl_error(size);
|
return process_ssl_error(size);
|
||||||
|
Loading…
Reference in New Issue
Block a user