aboutsummaryrefslogtreecommitdiff
path: root/nxcomp
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-07-12 21:36:11 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-07-26 10:12:44 +0200
commit4c3872279336b182fefa926c7e3e38152eb5fff4 (patch)
tree8f9dfde3795b3f0cad827a11884a9a178d9a2a2b /nxcomp
parent5a7b589bb3a32d49d2a196fe277a0d51f6afa541 (diff)
downloadnx-libs-4c3872279336b182fefa926c7e3e38152eb5fff4.tar.gz
nx-libs-4c3872279336b182fefa926c7e3e38152eb5fff4.tar.bz2
nx-libs-4c3872279336b182fefa926c7e3e38152eb5fff4.zip
nxcomp/src/Loop.cpp: Avoid duplicate usage of proxyFD (global variable) and *proxyFD (function parameter).
Diffstat (limited to 'nxcomp')
-rw-r--r--nxcomp/src/Loop.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp
index f29fae530..907ad04df 100644
--- a/nxcomp/src/Loop.cpp
+++ b/nxcomp/src/Loop.cpp
@@ -450,8 +450,8 @@ static int AcceptConnection(int fd, int domain, const char *label);
// Other convenience functions.
//
-static int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFD, int* reason);
-static int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* reason);
+static int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFileDescriptor, int* reason);
+static int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFileDescriptor, int* reason);
static int WaitForRemote(ChannelEndPoint &socketAddress);
static int ConnectToRemote(ChannelEndPoint &socketAddress);
@@ -6914,18 +6914,18 @@ WaitForRemoteError:
HandleCleanup();
}
-int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFD, int* reason)
+int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFileDescriptor, int* reason)
{
- if (!proxyFD)
+ if (!proxyFileDescriptor)
{
#ifdef PANIC
*logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). "
- << "'proxyFD' must not be a NULL pointer.\n" << logofs_flush;
+ << "'proxyFileDescriptor' must not be a NULL pointer.\n" << logofs_flush;
#endif
cerr << "Error" << ": Implementation error (PrepareProxyConnectionTCP). "
- << "'proxyFD' must not be a NULL pointer.\n";
+ << "'proxyFileDescriptor' must not be a NULL pointer.\n";
return -1;
}
@@ -6966,7 +6966,7 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
<< *hostName << ":" << *portNum << "'.\n"
<< logofs_flush;
- *proxyFD = -1;
+ *proxyFileDescriptor = -1;
*reason = -1;
sockaddr_in addr;
@@ -6974,10 +6974,10 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
addr.sin_port = htons(*portNum);
addr.sin_addr.s_addr = remoteIPAddr;
- *proxyFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC);
+ *proxyFileDescriptor = socket(AF_INET, SOCK_STREAM, PF_UNSPEC);
*reason = EGET();
- if (*proxyFD == -1)
+ if (*proxyFileDescriptor == -1)
{
#ifdef PANIC
*logofs << "Loop: PANIC! Call to socket failed. "
@@ -6991,7 +6991,7 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
return -1;
}
- else if (SetReuseAddress(*proxyFD) < 0)
+ else if (SetReuseAddress(*proxyFileDescriptor) < 0)
{
return -1;
}
@@ -7006,7 +7006,7 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
else
SetTimer(20000);
- int result = connect(*proxyFD, (sockaddr *) &addr, sizeof(sockaddr_in));
+ int result = connect(*proxyFileDescriptor, (sockaddr *) &addr, sizeof(sockaddr_in));
*reason = EGET();
@@ -7016,18 +7016,18 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
}
-int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* reason)
+int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFileDescriptor, int* reason)
{
- if (!proxyFD)
+ if (!proxyFileDescriptor)
{
#ifdef PANIC
*logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). "
- << "proxyFD must not be a NULL pointer.\n" << logofs_flush;
+ << "proxyFileDescriptor must not be a NULL pointer.\n" << logofs_flush;
#endif
cerr << "Error" << ": Implementation error (PrepareProxyConnectionUnix). "
- << "proxyFD must not be a NULL pointer.\n";
+ << "proxyFileDescriptor must not be a NULL pointer.\n";
return -1;
}
@@ -7047,17 +7047,17 @@ int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* rea
/* FIXME: Add socket file existence and permission checks */
- *proxyFD = -1;
+ *proxyFileDescriptor = -1;
*reason = -1;
sockaddr_un addr;
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, *path, 108 - 1);
- *proxyFD = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
+ *proxyFileDescriptor = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
*reason = EGET();
- if (*proxyFD == -1)
+ if (*proxyFileDescriptor == -1)
{
#ifdef PANIC
*logofs << "Loop: PANIC! Call to socket failed. "
@@ -7082,7 +7082,7 @@ int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* rea
else
SetTimer(20000);
- int result = connect(*proxyFD, (sockaddr *) &addr, sizeof(sockaddr_un));
+ int result = connect(*proxyFileDescriptor, (sockaddr *) &addr, sizeof(sockaddr_un));
*reason = EGET();