MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / process_ssl_error

Method process_ssl_error

tdport/td/net/SslStream.cpp:318–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316 SslWriteByteFlow write_flow_{this};
317
318 Result<size_t> process_ssl_error(int ret) {
319 auto os_error = OS_ERROR("SSL_ERROR_SYSCALL");
320 int error = SSL_get_error(ssl_handle_.get(), ret);
321 switch (error) {
322 case SSL_ERROR_NONE:
323 LOG(ERROR) << "SSL_get_error returned no error";
324 return 0;
325 case SSL_ERROR_ZERO_RETURN:
326 LOG(DEBUG) << "SSL_ZERO_RETURN";
327 return 0;
328 case SSL_ERROR_WANT_READ:
329 LOG(DEBUG) << "SSL_WANT_READ";
330 return 0;
331 case SSL_ERROR_WANT_WRITE:
332 LOG(DEBUG) << "SSL_WANT_WRITE";
333 return 0;
334 case SSL_ERROR_WANT_CONNECT:
335 case SSL_ERROR_WANT_ACCEPT:
336 case SSL_ERROR_WANT_X509_LOOKUP:
337 LOG(DEBUG) << "SSL: CONNECT ACCEPT LOOKUP";
338 return 0;
339 case SSL_ERROR_SYSCALL:
340 if (ERR_peek_error() == 0) {
341 if (os_error.code() != 0) {
342 LOG(DEBUG) << "SSL_ERROR_SYSCALL";
343 return std::move(os_error);
344 } else {
345 LOG(DEBUG) << "SSL_SYSCALL";
346 return 0;
347 }
348 }
349 /* fallthrough */
350 default:
351 LOG(DEBUG) << "SSL_ERROR Default";
352 return create_openssl_error(1, "SSL error ");
353 }
354 }
355};
356
357namespace {

Callers

nothing calls this directly

Calls 2

codeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected