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
c48748ba
Commit
c48748ba
authored
Dec 27, 2017
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ChannelEndPoint.cpp: re-scope/improve getSpec
parent
f1905c86
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
ChannelEndPoint.cpp
nxcomp/src/ChannelEndPoint.cpp
+19
-9
Loop.cpp
nxcomp/src/Loop.cpp
+2
-0
No files found.
nxcomp/src/ChannelEndPoint.cpp
View file @
c48748ba
...
@@ -113,13 +113,19 @@ ChannelEndPoint::setSpec(const char *hostName, long port) {
...
@@ -113,13 +113,19 @@ ChannelEndPoint::setSpec(const char *hostName, long port) {
bool
bool
ChannelEndPoint
::
getSpec
(
char
**
socketUri
)
const
{
ChannelEndPoint
::
getSpec
(
char
**
socketUri
)
const
{
if
(
socketUri
)
*
socketUri
=
NULL
;
if
(
socketUri
)
{
*
socketUri
=
NULL
;
}
else
{
return
false
;
}
char
*
unixPath
=
NULL
;
char
*
unixPath
=
NULL
;
char
*
hostName
=
NULL
;
char
*
hostName
=
NULL
;
long
port
=
-
1
;
long
port
=
-
1
;
char
*
newSocketUri
=
NULL
;
int
length
=
-
1
;
int
length
=
-
1
;
if
(
getUnixPath
(
&
unixPath
))
if
(
getUnixPath
(
&
unixPath
))
...
@@ -133,17 +139,21 @@ ChannelEndPoint::getSpec(char **socketUri) const {
...
@@ -133,17 +139,21 @@ ChannelEndPoint::getSpec(char **socketUri) const {
if
(
length
>
0
)
if
(
length
>
0
)
{
{
newSocketUri
=
static_cast
<
char
*>
(
calloc
(
length
+
1
,
sizeof
(
char
)));
char
*
newSocketUri
=
static_cast
<
char
*>
(
calloc
(
length
+
1
,
sizeof
(
char
)));
if
(
isUnixSocket
())
snprintf
(
newSocketUri
,
length
+
1
,
"unix:%s"
,
unixPath
);
if
(
newSocketUri
)
else
{
snprintf
(
newSocketUri
,
length
+
1
,
"tcp:%s:%ld"
,
hostName
,
port
);
if
(
isUnixSocket
())
snprintf
(
newSocketUri
,
length
+
1
,
"unix:%s"
,
unixPath
);
else
snprintf
(
newSocketUri
,
length
+
1
,
"tcp:%s:%ld"
,
hostName
,
port
);
if
(
socketUri
)
*
socketUri
=
strdup
(
newSocketUri
);
*
socketUri
=
strdup
(
newSocketUri
);
SAFE_FREE
(
newSocketUri
);
}
}
}
SAFE_FREE
(
newSocketUri
);
SAFE_FREE
(
unixPath
);
SAFE_FREE
(
unixPath
);
SAFE_FREE
(
hostName
);
SAFE_FREE
(
hostName
);
...
...
nxcomp/src/Loop.cpp
View file @
c48748ba
...
@@ -6222,6 +6222,8 @@ int WaitForRemote(ChannelEndPoint &socketAddress)
...
@@ -6222,6 +6222,8 @@ int WaitForRemote(ChannelEndPoint &socketAddress)
pFD
=
ListenConnection
(
socketAddress
,
"NX"
);
pFD
=
ListenConnection
(
socketAddress
,
"NX"
);
SAFE_FREE
(
socketUri
);
socketAddress
.
getSpec
(
&
socketUri
);
socketAddress
.
getSpec
(
&
socketUri
);
nxinfo
<<
"Loop: Waiting for connection from "
nxinfo
<<
"Loop: Waiting for connection from "
<<
hostLabel
<<
" on socket '"
<<
socketUri
<<
hostLabel
<<
" on socket '"
<<
socketUri
...
...
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