Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
4c387227
You need to sign in or sign up before continuing.
Commit
4c387227
authored
Jul 12, 2017
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nxcomp/src/Loop.cpp: Avoid duplicate usage of proxyFD (global variable) and…
nxcomp/src/Loop.cpp: Avoid duplicate usage of proxyFD (global variable) and *proxyFD (function parameter).
parent
5a7b589b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
Loop.cpp
nxcomp/src/Loop.cpp
+19
-19
No files found.
nxcomp/src/Loop.cpp
View file @
4c387227
...
@@ -450,8 +450,8 @@ static int AcceptConnection(int fd, int domain, const char *label);
...
@@ -450,8 +450,8 @@ static int AcceptConnection(int fd, int domain, const char *label);
// Other convenience functions.
// Other convenience functions.
//
//
static
int
PrepareProxyConnectionTCP
(
char
**
hostName
,
long
int
*
portNum
,
int
*
timeout
,
int
*
proxyF
D
,
int
*
reason
);
static
int
PrepareProxyConnectionTCP
(
char
**
hostName
,
long
int
*
portNum
,
int
*
timeout
,
int
*
proxyF
ileDescriptor
,
int
*
reason
);
static
int
PrepareProxyConnectionUnix
(
char
**
path
,
int
*
timeout
,
int
*
proxyF
D
,
int
*
reason
);
static
int
PrepareProxyConnectionUnix
(
char
**
path
,
int
*
timeout
,
int
*
proxyF
ileDescriptor
,
int
*
reason
);
static
int
WaitForRemote
(
ChannelEndPoint
&
socketAddress
);
static
int
WaitForRemote
(
ChannelEndPoint
&
socketAddress
);
static
int
ConnectToRemote
(
ChannelEndPoint
&
socketAddress
);
static
int
ConnectToRemote
(
ChannelEndPoint
&
socketAddress
);
...
@@ -6914,18 +6914,18 @@ WaitForRemoteError:
...
@@ -6914,18 +6914,18 @@ WaitForRemoteError:
HandleCleanup
();
HandleCleanup
();
}
}
int
PrepareProxyConnectionTCP
(
char
**
hostName
,
long
int
*
portNum
,
int
*
timeout
,
int
*
proxyF
D
,
int
*
reason
)
int
PrepareProxyConnectionTCP
(
char
**
hostName
,
long
int
*
portNum
,
int
*
timeout
,
int
*
proxyF
ileDescriptor
,
int
*
reason
)
{
{
if
(
!
proxyF
D
)
if
(
!
proxyF
ileDescriptor
)
{
{
#ifdef PANIC
#ifdef PANIC
*
logofs
<<
"Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). "
*
logofs
<<
"Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). "
<<
"'proxyF
D
' must not be a NULL pointer.
\n
"
<<
logofs_flush
;
<<
"'proxyF
ileDescriptor
' must not be a NULL pointer.
\n
"
<<
logofs_flush
;
#endif
#endif
cerr
<<
"Error"
<<
": Implementation error (PrepareProxyConnectionTCP). "
cerr
<<
"Error"
<<
": Implementation error (PrepareProxyConnectionTCP). "
<<
"'proxyF
D
' must not be a NULL pointer.
\n
"
;
<<
"'proxyF
ileDescriptor
' must not be a NULL pointer.
\n
"
;
return
-
1
;
return
-
1
;
}
}
...
@@ -6966,7 +6966,7 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
...
@@ -6966,7 +6966,7 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
<<
*
hostName
<<
":"
<<
*
portNum
<<
"'.
\n
"
<<
*
hostName
<<
":"
<<
*
portNum
<<
"'.
\n
"
<<
logofs_flush
;
<<
logofs_flush
;
*
proxyF
D
=
-
1
;
*
proxyF
ileDescriptor
=
-
1
;
*
reason
=
-
1
;
*
reason
=
-
1
;
sockaddr_in
addr
;
sockaddr_in
addr
;
...
@@ -6974,10 +6974,10 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
...
@@ -6974,10 +6974,10 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
addr
.
sin_port
=
htons
(
*
portNum
);
addr
.
sin_port
=
htons
(
*
portNum
);
addr
.
sin_addr
.
s_addr
=
remoteIPAddr
;
addr
.
sin_addr
.
s_addr
=
remoteIPAddr
;
*
proxyF
D
=
socket
(
AF_INET
,
SOCK_STREAM
,
PF_UNSPEC
);
*
proxyF
ileDescriptor
=
socket
(
AF_INET
,
SOCK_STREAM
,
PF_UNSPEC
);
*
reason
=
EGET
();
*
reason
=
EGET
();
if
(
*
proxyF
D
==
-
1
)
if
(
*
proxyF
ileDescriptor
==
-
1
)
{
{
#ifdef PANIC
#ifdef PANIC
*
logofs
<<
"Loop: PANIC! Call to socket failed. "
*
logofs
<<
"Loop: PANIC! Call to socket failed. "
...
@@ -6991,7 +6991,7 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
...
@@ -6991,7 +6991,7 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
return
-
1
;
return
-
1
;
}
}
else
if
(
SetReuseAddress
(
*
proxyF
D
)
<
0
)
else
if
(
SetReuseAddress
(
*
proxyF
ileDescriptor
)
<
0
)
{
{
return
-
1
;
return
-
1
;
}
}
...
@@ -7006,7 +7006,7 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
...
@@ -7006,7 +7006,7 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
else
else
SetTimer
(
20000
);
SetTimer
(
20000
);
int
result
=
connect
(
*
proxyF
D
,
(
sockaddr
*
)
&
addr
,
sizeof
(
sockaddr_in
));
int
result
=
connect
(
*
proxyF
ileDescriptor
,
(
sockaddr
*
)
&
addr
,
sizeof
(
sockaddr_in
));
*
reason
=
EGET
();
*
reason
=
EGET
();
...
@@ -7016,18 +7016,18 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
...
@@ -7016,18 +7016,18 @@ int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout,
}
}
int
PrepareProxyConnectionUnix
(
char
**
path
,
int
*
timeout
,
int
*
proxyF
D
,
int
*
reason
)
int
PrepareProxyConnectionUnix
(
char
**
path
,
int
*
timeout
,
int
*
proxyF
ileDescriptor
,
int
*
reason
)
{
{
if
(
!
proxyF
D
)
if
(
!
proxyF
ileDescriptor
)
{
{
#ifdef PANIC
#ifdef PANIC
*
logofs
<<
"Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). "
*
logofs
<<
"Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). "
<<
"proxyF
D
must not be a NULL pointer.
\n
"
<<
logofs_flush
;
<<
"proxyF
ileDescriptor
must not be a NULL pointer.
\n
"
<<
logofs_flush
;
#endif
#endif
cerr
<<
"Error"
<<
": Implementation error (PrepareProxyConnectionUnix). "
cerr
<<
"Error"
<<
": Implementation error (PrepareProxyConnectionUnix). "
<<
"proxyF
D
must not be a NULL pointer.
\n
"
;
<<
"proxyF
ileDescriptor
must not be a NULL pointer.
\n
"
;
return
-
1
;
return
-
1
;
}
}
...
@@ -7047,17 +7047,17 @@ int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* rea
...
@@ -7047,17 +7047,17 @@ int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* rea
/* FIXME: Add socket file existence and permission checks */
/* FIXME: Add socket file existence and permission checks */
*
proxyF
D
=
-
1
;
*
proxyF
ileDescriptor
=
-
1
;
*
reason
=
-
1
;
*
reason
=
-
1
;
sockaddr_un
addr
;
sockaddr_un
addr
;
addr
.
sun_family
=
AF_UNIX
;
addr
.
sun_family
=
AF_UNIX
;
strncpy
(
addr
.
sun_path
,
*
path
,
108
-
1
);
strncpy
(
addr
.
sun_path
,
*
path
,
108
-
1
);
*
proxyF
D
=
socket
(
AF_UNIX
,
SOCK_STREAM
,
PF_UNSPEC
);
*
proxyF
ileDescriptor
=
socket
(
AF_UNIX
,
SOCK_STREAM
,
PF_UNSPEC
);
*
reason
=
EGET
();
*
reason
=
EGET
();
if
(
*
proxyF
D
==
-
1
)
if
(
*
proxyF
ileDescriptor
==
-
1
)
{
{
#ifdef PANIC
#ifdef PANIC
*
logofs
<<
"Loop: PANIC! Call to socket failed. "
*
logofs
<<
"Loop: PANIC! Call to socket failed. "
...
@@ -7082,7 +7082,7 @@ int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* rea
...
@@ -7082,7 +7082,7 @@ int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* rea
else
else
SetTimer
(
20000
);
SetTimer
(
20000
);
int
result
=
connect
(
*
proxyF
D
,
(
sockaddr
*
)
&
addr
,
sizeof
(
sockaddr_un
));
int
result
=
connect
(
*
proxyF
ileDescriptor
,
(
sockaddr
*
)
&
addr
,
sizeof
(
sockaddr_un
));
*
reason
=
EGET
();
*
reason
=
EGET
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment