From 05d365e4b4c19576a9dd40ddc2699b439ec0de62 Mon Sep 17 00:00:00 2001 From: Massimiliano Pinto Date: Tue, 17 Dec 2013 11:07:29 +0100 Subject: [PATCH] fprintf(9 removed --- server/core/gw_utils.c | 4 ---- server/modules/protocol/httpd.c | 1 - server/modules/protocol/mysql_backend.c | 1 - server/modules/protocol/mysql_client.c | 5 ++--- server/modules/protocol/mysql_common.c | 24 +----------------------- 5 files changed, 3 insertions(+), 32 deletions(-) diff --git a/server/core/gw_utils.c b/server/core/gw_utils.c index c78017cdf..ad81843a8 100644 --- a/server/core/gw_utils.c +++ b/server/core/gw_utils.c @@ -136,7 +136,6 @@ int gw_read_gwbuff(DCB *dcb, GWBUF **head, int b) { int n = -1; if (b <= 0) { - //fprintf(stderr, "||| read_gwbuff called with 0 bytes for %i, closing\n", dcb->fd); ss_dassert(false); #if 0 dcb->func.close(dcb); @@ -157,11 +156,9 @@ int gw_read_gwbuff(DCB *dcb, GWBUF **head, int b) { if (n < 0) { if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { - /* fprintf(stderr, "Client connection %i: continue for %i, %s\n", dcb->fd, errno, strerror(errno)); */ gwbuf_free(buffer); return 1; } else { - /* fprintf(stderr, "Client connection %i error: %i, %s\n", dcb->fd, errno, strerror(errno)); */ gwbuf_free(buffer); (dcb->func).close(dcb); return 1; @@ -170,7 +167,6 @@ int gw_read_gwbuff(DCB *dcb, GWBUF **head, int b) { if (n == 0) { // socket closed - /* fprintf(stderr, "Client connection %i closed: %i, %s\n", dcb->fd, errno, strerror(errno)); */ gwbuf_free(buffer); #if 1 (dcb->func).close(dcb); diff --git a/server/modules/protocol/httpd.c b/server/modules/protocol/httpd.c index 4798b26b0..cc4faf0a9 100644 --- a/server/modules/protocol/httpd.c +++ b/server/modules/protocol/httpd.c @@ -204,7 +204,6 @@ HTTPD_session *client_data = NULL; if (strncasecmp(buf, "useragent", 9) == 0) { strcpy(client_data->useragent, value); } - //fprintf(stderr, "<<< Header [%s:%s]\n", buf, value); } } diff --git a/server/modules/protocol/mysql_backend.c b/server/modules/protocol/mysql_backend.c index da314760e..0cb80a059 100644 --- a/server/modules/protocol/mysql_backend.c +++ b/server/modules/protocol/mysql_backend.c @@ -862,7 +862,6 @@ static int gw_change_user(DCB *backend, SERVER *server, SESSION *in_session, GWB if (auth_ret != 0) { /*< vraa : errorHandle */ - fprintf(stderr, "<<< CLIENT AUTH FAILED for user [%s], user session will not change!\n", username); // send the error packet mysql_send_auth_error(backend->session->client, 1, 0, "Authorization failed on change_user"); diff --git a/server/modules/protocol/mysql_client.c b/server/modules/protocol/mysql_client.c index 00c19f0bc..6ea27410d 100644 --- a/server/modules/protocol/mysql_client.c +++ b/server/modules/protocol/mysql_client.c @@ -28,7 +28,9 @@ * 17/06/2013 Massimiliano Pinto Added Client To Gateway routines * 24/06/2013 Massimiliano Pinto Added: fetch passwords from service users' hashtable * 02/09/2013 Massimiliano Pinto Added: session refcount + * 16/12/2013 Massimiliano Pinto Added: client closed socket detection with recv(..., MSG_PEEK) */ + #include #include #include @@ -382,7 +384,6 @@ static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue) { */ // now get the user strcpy(username, (char *)(client_auth_packet + 4 + 4 + 4 + 1 + 23)); - /* fprintf(stderr, "<<< Client username is [%s]\n", username); */ // get the auth token len memcpy(&auth_token_len, @@ -394,7 +395,6 @@ static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue) { strcpy(database, (char *)(client_auth_packet + 4 + 4 + 4 + 1 + 23 + strlen(username) + 1 + 1 + auth_token_len)); - /* fprintf(stderr, "<<< Client selected db is [%s]\n", database); */ } else { /* fprintf(stderr, "<<< Client is NOT connected with db\n"); */ } @@ -730,7 +730,6 @@ int gw_write_client_event(DCB *dcb) ss_dassert(dcb->state != DCB_STATE_DISCONNECTED); if (dcb == NULL) { - fprintf(stderr, "DCB is NULL, return\n"); goto return_1; } diff --git a/server/modules/protocol/mysql_common.c b/server/modules/protocol/mysql_common.c index 2236986d6..a48ec8ed8 100644 --- a/server/modules/protocol/mysql_common.c +++ b/server/modules/protocol/mysql_common.c @@ -106,29 +106,17 @@ void gw_mysql_close(MySQLProtocol **ptr) { if (*ptr == NULL) return; -#ifdef MYSQL_CONN_DEBUG - fprintf(stderr, "Closing MySQL connection %i, [%s]\n", conn->fd, conn->scramble); -#endif if (conn->fd > 0) { /* COM_QUIT will not be sent here, but from the caller of this routine! */ -#ifdef MYSQL_CONN_DEBUG - fprintf(stderr, "mysqlgw_mysql_close() called for %i\n", conn->fd); -#endif close(conn->fd); } else { -#ifdef MYSQL_CONN_DEBUG - fprintf(stderr, "mysqlgw_mysql_close() called, no socket %i\n", conn->fd); -#endif + // no socket here } free(*ptr); *ptr = NULL; - -#ifdef MYSQL_CONN_DEBUG - fprintf(stderr, "mysqlgw_mysql_close() free(conn) done\n"); -#endif } /** @@ -429,10 +417,6 @@ int gw_send_authentication_to_backend( dcb = conn->owner_dcb; -#ifdef DEBUG_MYSQL_CONN - fprintf(stderr, ">> Sending credentials %s, %s, db %s\n", user, passwd, dbname); -#endif - // Zero the vars memset(&server_capabilities, '\0', sizeof(server_capabilities)); memset(&final_capabilities, '\0', sizeof(final_capabilities)); @@ -844,10 +828,6 @@ int gw_send_change_user_to_backend(char *dbname, char *user, uint8_t *passwd, My dcb = conn->owner_dcb; -#ifdef DEBUG_MYSQL_CONN - fprintf(stderr, ">> Sending credentials %s, %s, db %s\n", user, passwd, dbname); -#endif - // Zero the vars memset(&server_capabilities, '\0', sizeof(server_capabilities)); memset(&final_capabilities, '\0', sizeof(final_capabilities)); @@ -1029,7 +1009,6 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le ret_val = gw_find_mysql_user_password_sha1(username, password, (DCB *) dcb); if (ret_val) { - fprintf(stderr, "<<<< User [%s] was not found\n", username); return 1; } @@ -1044,7 +1023,6 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le /* check if the password is not set in the user table */ if (!strlen((char *)password)) { /* Username without password */ - //fprintf(stderr, ">>> continue WITHOUT auth, no password\n"); return 0; } else { return 1;