Commit 196e365d authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Exit if connect() fails first time.

parent f1afa3cd
...@@ -3,6 +3,7 @@ nmxptool Release History ...@@ -3,6 +3,7 @@ nmxptool Release History
######################### #########################
* Release 2.1.4-dev (2017/01/04) * Release 2.1.4-dev (2017/01/04)
- Exit if connect() fails first time.
- Fix checking port number for option -P and -D. - Fix checking port number for option -P and -D.
- Fix checking short-term-completion, option -S. - Fix checking short-term-completion, option -S.
- Fix checking rate, option -R. - Fix checking rate, option -R.
......
...@@ -106,6 +106,9 @@ int nmxp_openSocket(char *hostname, int portNum, int (*func_cond)(void)) ...@@ -106,6 +106,9 @@ int nmxp_openSocket(char *hostname, int portNum, int (*func_cond)(void))
isock, NMXP_LOG_STR(inet_ntoa(hostaddr)), portNum); isock, NMXP_LOG_STR(inet_ntoa(hostaddr)), portNum);
return isock; return isock;
} else { } else {
nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_CONNFLOW, "connect(): (errno=%d) %s \n", errno, NMXP_LOG_STR(nmxp_strerror(errno)));
return -1;
/*
nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_CONNFLOW, "Connecting to %s port %d. Trying again after %d seconds...\n", nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_CONNFLOW, "Connecting to %s port %d. Trying again after %d seconds...\n",
NMXP_LOG_STR(inet_ntoa(hostaddr)), portNum, sleepTime); NMXP_LOG_STR(inet_ntoa(hostaddr)), portNum, sleepTime);
nmxp_closeSocket(isock); nmxp_closeSocket(isock);
...@@ -120,6 +123,7 @@ int nmxp_openSocket(char *hostname, int portNum, int (*func_cond)(void)) ...@@ -120,6 +123,7 @@ int nmxp_openSocket(char *hostname, int portNum, int (*func_cond)(void))
if (sleepTime > NMXP_SLEEPMAX) { if (sleepTime > NMXP_SLEEPMAX) {
sleepTime = NMXP_SLEEPMAX; sleepTime = NMXP_SLEEPMAX;
} }
*/
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment