Dont use DEBUG messages, instead a much lower level messages for SSL related debug messages.

This commit is contained in:
Jan Vidar Krey 2009-08-03 19:55:57 +02:00
parent 7229ad68ab
commit a297c08bba
1 changed files with 19 additions and 17 deletions

View File

@ -48,7 +48,7 @@ static void net_con_event(int fd, short ev, void *arg)
}
else
{
LOG_DEBUG("net_con_event: ev=%d, con=%p", ev, con);
LOG_DUMP("net_con_event: ev=%d, con=%p", ev, con);
if (ev & (EV_READ | EV_WRITE))
{
if (net_con_flag_get(con, NET_WANT_SSL_ACCEPT))
@ -84,7 +84,7 @@ static void net_con_event(int fd, short ev, void *arg)
void net_con_initialize(struct net_connection* con, int sd, struct ip_addr_encap* addr, const void* ptr, int events)
{
LOG_DEBUG("net_con_initialize: sd=%d, ptr=%p", sd, ptr);
LOG_DUMP("net_con_initialize: sd=%d, ptr=%p", sd, ptr);
con->sd = sd;
con->ptr = (void*) ptr;
con->last_send = time(0);
@ -111,9 +111,9 @@ void net_con_initialize(struct net_connection* con, int sd, struct ip_addr_encap
con->write_len = 0;
con->ssl = SSL_new(g_hub->ssl_ctx);
LOG_DEBUG("SSL_new");
LOG_DUMP("SSL_new");
SSL_set_fd(con->ssl, con->sd);
LOG_DEBUG("SSL_set_fd");
LOG_DUMP("SSL_set_fd");
#endif
}
@ -146,39 +146,39 @@ static int handle_openssl_error(struct net_connection* con, int ret)
switch (error)
{
case SSL_ERROR_ZERO_RETURN:
LOG_DEBUG("SSL_get_error: ret=%d, error=%d: SSL_ERROR_ZERO_RETURN", ret, error);
LOG_DUMP("SSL_get_error: ret=%d, error=%d: SSL_ERROR_ZERO_RETURN", ret, error);
return -1;
case SSL_ERROR_WANT_READ:
LOG_DEBUG("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_READ", ret, error);
LOG_DUMP("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_READ", ret, error);
net_con_update(con, EV_READ);
net_con_flag_set(con, NET_WANT_SSL_READ);
return 0;
case SSL_ERROR_WANT_WRITE:
LOG_DEBUG("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_WRITE", ret, error);
LOG_DUMP("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_WRITE", ret, error);
net_con_update(con, EV_READ | EV_WRITE);
net_con_flag_set(con, NET_WANT_SSL_WRITE);
return 0;
case SSL_ERROR_WANT_CONNECT:
LOG_DEBUG("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_CONNECT", ret, error);
LOG_DUMP("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_CONNECT", ret, error);
net_con_update(con, EV_READ | EV_WRITE);
net_con_flag_set(con, NET_WANT_SSL_CONNECT);
return 0;
case SSL_ERROR_WANT_ACCEPT:
LOG_DEBUG("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_ACCEPT", ret, error);
LOG_DUMP("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_ACCEPT", ret, error);
net_con_update(con, EV_READ | EV_WRITE);
net_con_flag_set(con, NET_WANT_SSL_ACCEPT);
return 0;
case SSL_ERROR_WANT_X509_LOOKUP:
LOG_DEBUG("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_X509_LOOKUP", ret, error);
LOG_DUMP("SSL_get_error: ret=%d, error=%d: SSL_ERROR_WANT_X509_LOOKUP", ret, error);
return 0;
case SSL_ERROR_SYSCALL:
LOG_DEBUG("SSL_get_error: ret=%d, error=%d: SSL_ERROR_SYSCALL", ret, error);
LOG_DUMP("SSL_get_error: ret=%d, error=%d: SSL_ERROR_SYSCALL", ret, error);
/* if ret == 0, connection closed, if ret == -1, check with errno */
if (ret == 0)
return -1;
@ -186,7 +186,7 @@ static int handle_openssl_error(struct net_connection* con, int ret)
return -net_error();
case SSL_ERROR_SSL:
LOG_DEBUG("SSL_get_error: ret=%d, error=%d: SSL_ERROR_SSL", ret, error);
LOG_DUMP("SSL_get_error: ret=%d, error=%d: SSL_ERROR_SSL", ret, error);
/* internal openssl error */
return -1;
}
@ -203,7 +203,7 @@ ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len)
{
#endif
int ret = net_send(con->sd, buf, len, UHUB_SEND_SIGNAL);
LOG_DEBUG("net_send: ret=%d", ret);
LOG_DUMP("net_send: ret=%d", ret);
if (ret > 0)
{
con->last_send = time(0);
@ -225,7 +225,7 @@ ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len)
len = con->write_len;
int ret = SSL_write(con->ssl, buf, len);
LOG_DEBUG("net_send: ret=%d", ret);
LOG_DUMP("net_send: ret=%d", ret);
if (ret > 0)
{
con->last_send = time(0);
@ -251,7 +251,7 @@ ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len)
{
#endif
int ret = net_recv(con->sd, buf, len, 0);
LOG_DEBUG("net_send: ret=%d", ret);
LOG_DUMP("net_send: ret=%d", ret);
if (ret > 0)
{
con->last_recv = time(0);
@ -270,7 +270,7 @@ ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len)
else
{
int ret = SSL_read(con->ssl, buf, len);
LOG_DEBUG("net_send: ret=%d", ret);
LOG_DUMP("net_send: ret=%d", ret);
if (ret > 0)
{
con->last_recv = time(0);
@ -290,7 +290,7 @@ ssize_t net_con_ssl_accept(struct net_connection* con)
{
net_con_flag_set(con, NET_WANT_SSL_ACCEPT);
ssize_t ret = SSL_accept(con->ssl);
LOG_DEBUG("SSL_accept() ret=%d", ret);
LOG_DUMP("SSL_accept() ret=%d", ret);
if (ret > 0)
{
net_con_flag_unset(con, NET_WANT_SSL_ACCEPT);
@ -307,9 +307,11 @@ ssize_t net_con_ssl_connect(struct net_connection* con)
{
net_con_flag_set(con, NET_WANT_SSL_CONNECT);
ssize_t ret = SSL_connect(con->ssl);
LOG_DUMP("SSL_connect() ret=%d", ret);
if (ret > 0)
{
net_con_flag_unset(con, NET_WANT_SSL_CONNECT);
net_con_flag_unset(con, NET_WANT_SSL_WRITE);
}
else
{