add ssl debug info

This commit is contained in:
lxsang 2019-12-13 09:52:28 +01:00
parent 3f2af063aa
commit 079f96de66
2 changed files with 5 additions and 2 deletions

Binary file not shown.

View File

@ -88,6 +88,8 @@ int antd_send(void *src, const void* data, int len)
struct timeval timeout; struct timeval timeout;
while (writelen > 0) //source->attempt < MAX_ATTEMPT while (writelen > 0) //source->attempt < MAX_ATTEMPT
{ {
// clear the error queue
ERR_clear_error();
count = SSL_write (source->ssl, ptr+written, writelen); count = SSL_write (source->ssl, ptr+written, writelen);
if (count > 0) if (count > 0)
{ {
@ -160,7 +162,7 @@ int antd_send(void *src, const void* data, int len)
default: default:
{ {
// other error // other error
ERROR("SSL WRITE: Unknown error on %d: %d", source->sock, err); ERROR("SSL WRITE: Unknown error on %d: %s", source->sock, ERR_error_string(ERR_get_error(), NULL) );
break; break;
} }
} }
@ -218,6 +220,7 @@ int antd_recv(void *src, void* data, int len)
struct timeval timeout; struct timeval timeout;
while (readlen > 0 )//&& source->attempt < MAX_ATTEMPT while (readlen > 0 )//&& source->attempt < MAX_ATTEMPT
{ {
ERR_clear_error();
received = SSL_read (source->ssl, ptr+read, readlen); received = SSL_read (source->ssl, ptr+read, readlen);
if (received > 0) if (received > 0)
{ {
@ -290,7 +293,7 @@ int antd_recv(void *src, void* data, int len)
default: default:
{ {
// other error // other error
ERROR("SSL READ: unkown error on %d: %d", source->sock, err); ERROR("SSL READ: unkown error on %d: %s", source->sock, ERR_error_string(ERR_get_error(), NULL));
break; break;
} }
} }