Removed useless code from mysql_backend.c and mysql_common.c

This commit is contained in:
Massimiliano Pinto
2013-07-04 15:19:52 +02:00
parent 4adf121de9
commit e8ee2a3e9b
2 changed files with 19 additions and 38 deletions

View File

@ -451,7 +451,8 @@ int gw_do_connect_to_backend(char *host, int port, MySQLProtocol *conn) {
conn->fd = so;
if (so < 0) {
fprintf(stderr, "Errore creazione socket: [%s] %i\n", strerror(errno), errno);
fprintf(stderr, "Error creating backend socket: [%s] %i\n", strerror(errno), errno);
// this is an error
return -1;
}
@ -461,16 +462,19 @@ int gw_do_connect_to_backend(char *host, int port, MySQLProtocol *conn) {
setnonblocking(so);
if ((rv = connect(so, (struct sockaddr *)&serv_addr, sizeof(serv_addr))) < 0) {
fprintf(stderr, "Errore connect %i, %s: RV = [%i]\n", errno, strerror(errno), rv);
// If connection is not yet completed just return 1
if (errno == EINPROGRESS) {
fprintf(stderr, ">>> Connection not yet completed for backend server [%s:%i]: errno %i, %s: RV = [%i]\n", host, port, errno, strerror(errno), rv);
return 1;
} else {
close(so);
// this is a real error
fprintf(stderr, ">>> ERROR connecting to backend server [%s:%i]: errno %i, %s: RV = [%i]\n", host, port, errno, strerror(errno), rv);
return -1;
}
}
// connection succesfully completed
return 0;
}