Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
fc6ef0eb
Commit
fc6ef0eb
authored
Feb 03, 2019
by
Simon Giesecke
Committed by
Simon Giesecke
Feb 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: zmq::get_peer_ip_address duplicates code from get_socket_address
Solution: change to use get_socket_address
parent
2f7a4502
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
18 deletions
+8
-18
ip.cpp
src/ip.cpp
+8
-18
No files found.
src/ip.cpp
View file @
fc6ef0eb
...
...
@@ -32,6 +32,7 @@
#include "err.hpp"
#include "macros.hpp"
#include "config.hpp"
#include "address.hpp"
#if !defined ZMQ_HAVE_WINDOWS
#include <fcntl.h>
...
...
@@ -145,39 +146,28 @@ void zmq::enable_ipv4_mapping (fd_t s_)
int
zmq
::
get_peer_ip_address
(
fd_t
sockfd_
,
std
::
string
&
ip_addr_
)
{
int
rc
;
struct
sockaddr_storage
ss
;
#if defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_WINDOWS \
|| defined ZMQ_HAVE_VXWORKS
int
addrlen
=
static_cast
<
int
>
(
sizeof
ss
);
#else
socklen_t
addrlen
=
sizeof
ss
;
#endif
rc
=
getpeername
(
sockfd_
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
ss
),
&
addrlen
);
zmq_socklen_t
addrlen
=
get_socket_address
(
sockfd_
,
socket_end_remote
,
&
ss
);
if
(
addrlen
==
0
)
{
#ifdef ZMQ_HAVE_WINDOWS
if
(
rc
==
SOCKET_ERROR
)
{
const
int
last_error
=
WSAGetLastError
();
wsa_assert
(
last_error
!=
WSANOTINITIALISED
&&
last_error
!=
WSAEFAULT
&&
last_error
!=
WSAEINPROGRESS
&&
last_error
!=
WSAENOTSOCK
);
return
0
;
}
#else
if
(
rc
==
-
1
)
{
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
#elif !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
errno_assert
(
errno
!=
EBADF
&&
errno
!=
EFAULT
&&
errno
!=
ENOTSOCK
);
#else
errno_assert
(
errno
!=
EFAULT
&&
errno
!=
ENOTSOCK
);
#endif
return
0
;
}
#endif
char
host
[
NI_MAXHOST
];
rc
=
getnameinfo
(
reinterpret_cast
<
struct
sockaddr
*>
(
&
ss
),
addrlen
,
host
,
sizeof
host
,
NULL
,
0
,
NI_NUMERICHOST
);
int
rc
=
getnameinfo
(
reinterpret_cast
<
struct
sockaddr
*>
(
&
ss
),
addrlen
,
host
,
sizeof
host
,
NULL
,
0
,
NI_NUMERICHOST
);
if
(
rc
!=
0
)
return
0
;
...
...
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