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
5fe6ddfd
Commit
5fe6ddfd
authored
May 07, 2012
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
On Windows, preventing sockets to be inherited by child processes.
parent
5dc44a63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
ip.cpp
src/ip.cpp
+6
-0
signaler.cpp
src/signaler.cpp
+9
-1
tcp_listener.cpp
src/tcp_listener.cpp
+6
-0
No files found.
src/ip.cpp
View file @
5fe6ddfd
...
...
@@ -57,6 +57,12 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
errno_assert
(
rc
!=
-
1
);
#endif
// On Windows, preventing sockets to be inherited by child processes.
#if defined ZMQ_HAVE_WINDOWS && defined HANDLE_FLAG_INHERIT
BOOL
brc
=
SetHandleInformation
((
HANDLE
)
s
,
HANDLE_FLAG_INHERIT
,
0
);
win_assert
(
brc
);
#endif
return
s
;
}
...
...
src/signaler.cpp
View file @
5fe6ddfd
...
...
@@ -288,6 +288,10 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
*
w_
=
WSASocket
(
AF_INET
,
SOCK_STREAM
,
0
,
NULL
,
0
,
0
);
wsa_assert
(
*
w_
!=
INVALID_SOCKET
);
// On Windows, preventing sockets to be inherited by child processes.
BOOL
brc
=
SetHandleInformation
((
HANDLE
)
*
w_
,
HANDLE_FLAG_INHERIT
,
0
);
win_assert
(
brc
);
// Set TCP_NODELAY on writer socket.
rc
=
setsockopt
(
*
w_
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
char
*
)
&
tcp_nodelay
,
sizeof
(
tcp_nodelay
));
...
...
@@ -301,12 +305,16 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
*
r_
=
accept
(
listener
,
NULL
,
NULL
);
wsa_assert
(
*
r_
!=
INVALID_SOCKET
);
// On Windows, preventing sockets to be inherited by child processes.
brc
=
SetHandleInformation
((
HANDLE
)
*
r_
,
HANDLE_FLAG_INHERIT
,
0
);
win_assert
(
brc
);
// We don't need the listening socket anymore. Close it.
rc
=
closesocket
(
listener
);
wsa_assert
(
rc
!=
SOCKET_ERROR
);
// Exit the critical section.
BOOL
brc
=
SetEvent
(
sync
);
brc
=
SetEvent
(
sync
);
win_assert
(
brc
!=
0
);
return
0
;
...
...
src/tcp_listener.cpp
View file @
5fe6ddfd
...
...
@@ -164,6 +164,9 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
wsa_error_to_errno
();
return
-
1
;
}
// On Windows, preventing sockets to be inherited by child processes.
BOOL
brc
=
SetHandleInformation
((
HANDLE
)
s
,
HANDLE_FLAG_INHERIT
,
0
);
win_assert
(
brc
);
#else
if
(
s
==
-
1
)
return
-
1
;
...
...
@@ -227,6 +230,9 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
WSAGetLastError
()
==
WSAECONNRESET
);
return
retired_fd
;
}
// On Windows, preventing sockets to be inherited by child processes.
BOOL
brc
=
SetHandleInformation
((
HANDLE
)
sock
,
HANDLE_FLAG_INHERIT
,
0
);
win_assert
(
brc
);
#else
if
(
sock
==
-
1
)
{
errno_assert
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
||
...
...
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