aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/src/Loop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'nxcomp/src/Loop.cpp')
-rw-r--r--nxcomp/src/Loop.cpp92
1 files changed, 43 insertions, 49 deletions
diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp
index 197167380..b51d7e7e3 100644
--- a/nxcomp/src/Loop.cpp
+++ b/nxcomp/src/Loop.cpp
@@ -391,7 +391,7 @@ static int CheckProcess(int pid, const char *label);
// Start or restart the house-keeper process.
//
-static int StartKeeper();
+static void StartKeeper();
//
// Cleanup functions.
@@ -425,10 +425,10 @@ static int SetupProxyInstance();
static int SetupAuthInstance();
static int SetupAgentInstance();
-static int SetupTcpSocket();
-static int SetupUnixSocket();
-static int SetupServiceSockets();
-static int SetupDisplaySocket(int &addr_family, sockaddr *&addr,
+static void SetupTcpSocket();
+static void SetupUnixSocket();
+static void SetupServiceSockets();
+static void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
unsigned int &addr_length);
//
@@ -2578,15 +2578,15 @@ int NXTransPrepare(int *setFDs, fd_set *readSet,
if (isTimestamp(*selectTs) == 0)
{
nxinfo << "Loop: WARNING! Preparing the select with requested "
- << "timeout of " << selectTs -> tv_sec << " S and "
- << (double) selectTs -> tv_usec / 1000 << " Ms.\n"
+ << "timeout of " << selectTs -> tv_sec << " s and "
+ << (double) selectTs -> tv_usec / 1000 << " ms.\n"
<< std::flush;
}
else
{
nxinfo << "Loop: Preparing the select with requested "
- << "timeout of " << selectTs -> tv_sec << " S and "
- << (double) selectTs -> tv_usec / 1000 << " Ms.\n"
+ << "timeout of " << selectTs -> tv_sec << " s and "
+ << (double) selectTs -> tv_usec / 1000 << " ms.\n"
<< std::flush;
}
@@ -2632,7 +2632,7 @@ int NXTransPrepare(int *setFDs, fd_set *readSet,
int diffTs = diffTimestamp(startTs, nowTs);
nxinfo << "Loop: Mark - 0 - at " << strMsTimestamp()
- << " with " << diffTs << " Ms elapsed.\n"
+ << " with " << diffTs << " ms elapsed.\n"
<< std::flush;
//
@@ -2701,7 +2701,7 @@ int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
if (diffTs > 20)
{
nxdbg << "Loop: TIME! Spent " << diffTs
- << " Ms handling messages for proxy FD#"
+ << " ms handling messages for proxy FD#"
<< proxyFD << ".\n" << std::flush;
}
@@ -2711,8 +2711,8 @@ int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
if (isTimestamp(*selectTs) == 0)
{
nxinfo << "Loop: WARNING! Executing the select with requested "
- << "timeout of " << selectTs -> tv_sec << " S and "
- << (double) selectTs -> tv_usec / 1000 << " Ms.\n"
+ << "timeout of " << selectTs -> tv_sec << " s and "
+ << (double) selectTs -> tv_usec / 1000 << " ms.\n"
<< std::flush;
}
else if (proxy != NULL && proxy -> getFlushable(proxyFD) > 0)
@@ -2720,8 +2720,8 @@ int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
nxinfo << "Loop: WARNING! Proxy FD#" << proxyFD
<< " has " << proxy -> getFlushable(proxyFD)
<< " bytes to write but timeout is "
- << selectTs -> tv_sec << " S and "
- << selectTs -> tv_usec / 1000 << " Ms.\n"
+ << selectTs -> tv_sec << " s and "
+ << selectTs -> tv_usec / 1000 << " ms.\n"
<< std::flush;
}
@@ -2742,7 +2742,7 @@ int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
if (diffTs > 100)
{
nxdbg << "Loop: TIME! Spent " << diffTs
- << " Ms waiting for new data for proxy FD#"
+ << " ms waiting for new data for proxy FD#"
<< proxyFD << ".\n" << std::flush;
}
@@ -2767,7 +2767,7 @@ int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
diffTs = diffTimestamp(startTs, nowTs);
- nxinfo << "Loop: Out of select after " << diffTs << " Ms "
+ nxinfo << "Loop: Out of select after " << diffTs << " ms "
<< "at " << strMsTimestamp(nowTs) << " with result "
<< *resultFDs << ".\n" << std::flush;
@@ -2874,7 +2874,7 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
nxinfo << "Loop: Mark - 1 - at " << strMsTimestamp()
<< " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << std::flush;
+ << " ms elapsed.\n" << std::flush;
//
// Rotate the channel that will be handled
@@ -2891,7 +2891,7 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
nxinfo << "Loop: Mark - 2 - at " << strMsTimestamp()
<< " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << std::flush;
+ << " ms elapsed.\n" << std::flush;
//
// Check if any socket has become readable.
@@ -2901,7 +2901,7 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
nxinfo << "Loop: Mark - 3 - at " << strMsTimestamp()
<< " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << std::flush;
+ << " ms elapsed.\n" << std::flush;
//
// Handle the scheduled events on channels.
@@ -2923,7 +2923,7 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
nxinfo << "Loop: Mark - 4 - at " << strMsTimestamp()
<< " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << std::flush;
+ << " ms elapsed.\n" << std::flush;
//
// Check if user sent a signal to produce
@@ -2946,7 +2946,7 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
nxinfo << "Loop: Mark - 5 - at " << strMsTimestamp()
<< " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << std::flush;
+ << " ms elapsed.\n" << std::flush;
//
// Check if there is any data to flush.
@@ -2958,7 +2958,7 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
nxinfo << "Loop: Mark - 6 - at " << strMsTimestamp()
<< " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << std::flush;
+ << " ms elapsed.\n" << std::flush;
}
//
@@ -2991,7 +2991,7 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
nxinfo << "Loop: Mark - 7 - at " << strMsTimestamp()
<< " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << std::flush;
+ << " ms elapsed.\n" << std::flush;
}
//
@@ -3360,7 +3360,7 @@ int InitAfterNegotiation()
nxinfo << "Loop: INIT! Completed initialization at "
<< strMsTimestamp(nowTs) << " with "
- << diffTimestamp(initTs, nowTs) << " Ms "
+ << diffTimestamp(initTs, nowTs) << " ms "
<< "since the init mark.\n" << std::flush;
initTs = getNewTimestamp();
@@ -3735,16 +3735,16 @@ int SetupAgentInstance()
return 1;
}
-int SetupTcpSocket()
+void SetupTcpSocket()
{
//
// Open TCP socket emulating local display.
//
- return ListenConnectionTCP((loopbackBind ? "localhost" : "*"), X_TCP_PORT + proxyPort, "X11");
+ tcpFD = ListenConnectionTCP((loopbackBind ? "localhost" : "*"), X_TCP_PORT + proxyPort, "X11");
}
-int SetupUnixSocket()
+void SetupUnixSocket()
{
//
// Open UNIX domain socket for display.
@@ -3763,7 +3763,7 @@ int SetupUnixSocket()
unixFD = ListenConnectionUnix(unixSocketName, "x11");
if (unixFD >= 0)
chmod(unixSocketName, 0777);
- return unixFD;
+ return;
}
}
@@ -3781,7 +3781,7 @@ int SetupUnixSocket()
// implementation.
//
-int SetupDisplaySocket(int &addr_family, sockaddr *&addr,
+void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
unsigned int &addr_length)
{
addr_family = AF_INET;
@@ -3948,7 +3948,7 @@ int SetupDisplaySocket(int &addr_family, sockaddr *&addr,
close(testSocketFD);
addr = (sockaddr *) xServerAddrABSTRACT;
- return 1;
+ return;
} else {
@@ -4061,11 +4061,9 @@ int SetupDisplaySocket(int &addr_family, sockaddr *&addr,
}
delete [] display;
-
- return 1;
}
-int SetupServiceSockets()
+void SetupServiceSockets()
{
if (control -> ProxyMode == proxy_client)
{
@@ -4148,8 +4146,6 @@ int SetupServiceSockets()
useSlaveSocket = 0;
}
}
-
- return 1;
}
int ListenConnectionAny(sockaddr *addr, socklen_t addrlen, const char *label)
@@ -4453,7 +4449,7 @@ int CheckProcess(int pid, const char *label)
return 1;
}
-int StartKeeper()
+void StartKeeper()
{
if (IsRunning(lastKeeper) == 1 ||
@@ -4511,8 +4507,6 @@ int StartKeeper()
<< "with persistent cache not enabled.\n"
<< std::flush;
}
-
- return 1;
}
void HandleCleanupForReconnect()
@@ -6083,8 +6077,8 @@ void SetTimer(int value)
timer.it_value = lastTimer.next;
nxinfo << "Loop: Timer set to " << lastTimer.next.tv_sec
- << " S and " << lastTimer.next.tv_usec / 1000
- << " Ms at " << strMsTimestamp() << " in process "
+ << " s and " << lastTimer.next.tv_usec / 1000
+ << " ms at " << strMsTimestamp() << " in process "
<< "with pid '" << getpid() << "'.\n"
<< std::flush;
@@ -6606,7 +6600,7 @@ int ConnectToRemote(ChannelEndPoint &socketAddress)
{
nxdbg << "Loop: Timer set to " << connectTimeout / 1000
- << " S " << "with retry set to " << retryConnect
+ << " s " << "with retry set to " << retryConnect
<< " in process with pid '" << getpid()
<< "'.\n" << std::flush;
@@ -13805,7 +13799,7 @@ static void handleCheckSessionInLoop()
}
nxinfo << "Loop: Starting watchdog process with timeout "
- << "of " << timeout << " Ms.\n"
+ << "of " << timeout << " ms.\n"
<< std::flush;
}
else
@@ -14070,9 +14064,9 @@ static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet,
}
nxinfo << "Loop: Select timeout is "
- << selectTs.tv_sec << " S and "
+ << selectTs.tv_sec << " s and "
<< (double) selectTs.tv_usec / 1000
- << " Ms.\n" << std::flush;
+ << " ms.\n" << std::flush;
}
static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet,
@@ -14088,14 +14082,14 @@ static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs,
nxinfo << "Loop: Select result is [" << resultFDs
<< "] at " << strMsTimestamp() << " with no "
<< "communication within " << diffTs
- << " Ms.\n" << std::flush;
+ << " ms.\n" << std::flush;
}
else
{
nxinfo << "Loop: Select result is [" << resultFDs
<< "] error is [" << errorFDs << "] at "
<< strMsTimestamp() << " after " << diffTs
- << " Ms.\n" << std::flush;
+ << " ms.\n" << std::flush;
}
@@ -14530,8 +14524,8 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
setMinTimestamp(selectTs, control -> PingTimeout);
nxinfo << "Loop: Selected proxy FD#" << proxyFD << " in negotiation "
- << "phase with timeout of " << selectTs.tv_sec << " S and "
- << selectTs.tv_usec << " Ms.\n" << std::flush;
+ << "phase with timeout of " << selectTs.tv_sec << " s and "
+ << selectTs.tv_usec << " ms.\n" << std::flush;
return;