Added more debug output.

This commit is contained in:
Markus Makela 2015-06-08 18:04:43 +03:00
parent 61ea0861ff
commit 1c36cfb285
4 changed files with 29 additions and 7 deletions

View File

@ -2825,14 +2825,19 @@ int dcb_create_SSL(DCB* dcb)
*/
int dcb_accept_SSL(DCB* dcb)
{
int rval = 0,ssl_rval,errnum,fd,b = 0;
int rval = 0,ssl_rval,errnum = 0,fd,b = 0;
char errbuf[140];
fd = dcb->fd;
ioctl(fd,FIONREAD,&b);
#ifdef SS_DEBUG
skygw_log_write(LD,"[dcb_accept_SSL] fd %d bytes: %d",fd,b);
#endif
while(b > 0 && rval != -1)
{
ssl_rval = SSL_accept(dcb->ssl);
#ifdef SS_DEBUG
skygw_log_write(LD,"[dcb_accept_SSL] SSL_accept returned %d.",ssl_rval);
#endif
switch(ssl_rval)
{
case 0:
@ -2882,8 +2887,10 @@ int dcb_accept_SSL(DCB* dcb)
break;
}
ioctl(fd,FIONREAD,&b);
if(LOG_IS_ENABLED(LD) && b > 0)
skygw_log_write_flush(LD,"[dcb_accept_SSL] FD %d has %d bytes ",fd,b);
#ifdef SS_DEBUG
skygw_log_write_flush(LD,"[dcb_accept_SSL] fd %d: %d bytes",fd,b);
skygw_log_write_flush(LD,"[dcb_accept_SSL] SSL error: %d",errnum);
#endif
}
return rval;
}

View File

@ -321,7 +321,7 @@ typedef struct {
#define MYSQL_IS_CHANGE_USER(payload) (MYSQL_GET_COMMAND(payload)==0x11)
#define MYSQL_GET_NATTR(payload) ((int)payload[4])
#endif /** _MYSQL_PROTOCOL_H */
MySQLProtocol* mysql_protocol_init(DCB* dcb, int fd);
void mysql_protocol_done (DCB* dcb);
@ -417,4 +417,4 @@ void init_response_status (
int* npackets,
ssize_t* nbytes);
#endif /** _MYSQL_PROTOCOL_H */

View File

@ -652,9 +652,16 @@ int gw_read_client_event(
protocol = DCB_PROTOCOL(dcb, MySQLProtocol);
CHK_PROTOCOL(protocol);
#ifdef SS_DEBUG
skygw_log_write(LD,"[gw_read_client_event] Protocol state: %s",
gw_mysql_protocol_state2string(protocol->protocol_auth_state));
#endif
if(protocol->protocol_auth_state == MYSQL_AUTH_SSL_HANDSHAKE_ONGOING ||
protocol->protocol_auth_state == MYSQL_AUTH_SSL_REQ)
{
switch(do_ssl_accept(protocol))
{
case 0:
@ -1943,6 +1950,10 @@ int do_ssl_accept(MySQLProtocol* protocol)
rval);
break;
}
#ifdef SS_DEBUG
skygw_log_write(LD,"[do_ssl_accept] Protocol state: %s",
gw_mysql_protocol_state2string(protocol->protocol_auth_state));
#endif
return rval;
}

View File

@ -890,7 +890,11 @@ gw_mysql_protocol_state2string (int state) {
case MYSQL_AUTH_FAILED:
return "MySQL Authentication failed";
case MYSQL_IDLE:
return "MySQL authentication is succesfully done.";
return "MySQL authentication is succesfully done.";
case MYSQL_AUTH_SSL_REQ: return "MYSQL_AUTH_SSL_REQ";
case MYSQL_AUTH_SSL_HANDSHAKE_DONE: return "MYSQL_AUTH_SSL_HANDSHAKE_DONE";
case MYSQL_AUTH_SSL_HANDSHAKE_FAILED: return "MYSQL_AUTH_SSL_HANDSHAKE_FAILED";
case MYSQL_AUTH_SSL_HANDSHAKE_ONGOING: return "MYSQL_AUTH_SSL_HANDSHAKE_ONGOING";
default:
return "MySQL (unknown protocol state)";
}