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
471013a5
Commit
471013a5
authored
Sep 19, 2010
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
two races fixed in session creation
parent
1f10208a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
zmq_init.cpp
src/zmq_init.cpp
+12
-4
No files found.
src/zmq_init.cpp
View file @
471013a5
...
@@ -153,14 +153,18 @@ void zmq::zmq_init_t::finalise_initialisation ()
...
@@ -153,14 +153,18 @@ void zmq::zmq_init_t::finalise_initialisation ()
zmq_assert
(
socket
);
zmq_assert
(
socket
);
// We have no associated session. If the peer has no identity we'll
// We have no associated session. If the peer has no identity we'll
// create a transient session for the connection.
// create a transient session for the connection. Note that
// seqnum is incremented to account for attach command before the
// session is launched. That way we are sure it won't terminate before
// being attached.
if
(
peer_identity
[
0
]
==
0
)
{
if
(
peer_identity
[
0
]
==
0
)
{
session
=
new
(
std
::
nothrow
)
transient_session_t
(
io_thread
,
session
=
new
(
std
::
nothrow
)
transient_session_t
(
io_thread
,
socket
,
options
);
socket
,
options
);
zmq_assert
(
session
);
zmq_assert
(
session
);
session
->
inc_seqnum
();
launch_sibling
(
session
);
launch_sibling
(
session
);
engine
->
unplug
();
engine
->
unplug
();
send_attach
(
session
,
engine
,
peer_identity
,
tru
e
);
send_attach
(
session
,
engine
,
peer_identity
,
fals
e
);
engine
=
NULL
;
engine
=
NULL
;
terminate
();
terminate
();
return
;
return
;
...
@@ -179,13 +183,17 @@ void zmq::zmq_init_t::finalise_initialisation ()
...
@@ -179,13 +183,17 @@ void zmq::zmq_init_t::finalise_initialisation ()
return
;
return
;
}
}
// There's no such named session. We have to create one.
// There's no such named session. We have to create one. Note that
// seqnum is incremented to account for attach command before the
// session is launched. That way we are sure it won't terminate before
// being attached.
session
=
new
(
std
::
nothrow
)
named_session_t
(
io_thread
,
socket
,
session
=
new
(
std
::
nothrow
)
named_session_t
(
io_thread
,
socket
,
options
,
peer_identity
);
options
,
peer_identity
);
zmq_assert
(
session
);
zmq_assert
(
session
);
session
->
inc_seqnum
();
launch_sibling
(
session
);
launch_sibling
(
session
);
engine
->
unplug
();
engine
->
unplug
();
send_attach
(
session
,
engine
,
peer_identity
,
tru
e
);
send_attach
(
session
,
engine
,
peer_identity
,
fals
e
);
engine
=
NULL
;
engine
=
NULL
;
terminate
();
terminate
();
return
;
return
;
...
...
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