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
b64b50ae
Commit
b64b50ae
authored
Oct 15, 2010
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Timers correctly canceled by PGM engines on shutdown.
Signed-off-by:
Martin Sustrik
<
sustrik@250bpm.com
>
parent
e288f7a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
pgm_receiver.cpp
src/pgm_receiver.cpp
+7
-3
pgm_sender.cpp
src/pgm_sender.cpp
+14
-3
pgm_sender.hpp
src/pgm_sender.hpp
+2
-1
No files found.
src/pgm_receiver.cpp
View file @
b64b50ae
...
...
@@ -36,6 +36,7 @@
zmq
::
pgm_receiver_t
::
pgm_receiver_t
(
class
io_thread_t
*
parent_
,
const
options_t
&
options_
)
:
io_object_t
(
parent_
),
has_rx_timer
(
false
),
pgm_socket
(
true
,
options_
),
options
(
options_
),
inout
(
NULL
),
...
...
@@ -81,7 +82,11 @@ void zmq::pgm_receiver_t::unplug ()
mru_decoder
=
NULL
;
pending_bytes
=
0
;
// Stop polling.
if
(
has_rx_timer
)
{
cancel_timer
(
rx_timer_id
);
has_rx_timer
=
false
;
}
rm_fd
(
socket_handle
);
rm_fd
(
pipe_handle
);
...
...
@@ -150,8 +155,7 @@ void zmq::pgm_receiver_t::in_event ()
// No data to process. This may happen if the packet received is
// neither ODATA nor ODATA.
if
(
received
==
0
)
{
const
int
last_errno
=
errno
;
if
(
last_errno
==
ENOMEM
||
last_errno
==
EBUSY
)
{
if
(
errno
==
ENOMEM
||
errno
==
EBUSY
)
{
const
long
timeout
=
pgm_socket
.
get_rx_timeout
();
add_timer
(
timeout
,
rx_timer_id
);
has_rx_timer
=
true
;
...
...
src/pgm_sender.cpp
View file @
b64b50ae
...
...
@@ -36,6 +36,8 @@
zmq
::
pgm_sender_t
::
pgm_sender_t
(
io_thread_t
*
parent_
,
const
options_t
&
options_
)
:
io_object_t
(
parent_
),
has_tx_timer
(
false
),
has_rx_timer
(
false
),
encoder
(
0
),
pgm_socket
(
false
,
options_
),
options
(
options_
),
...
...
@@ -89,6 +91,16 @@ void zmq::pgm_sender_t::plug (io_thread_t *io_thread_, i_inout *inout_)
void
zmq
::
pgm_sender_t
::
unplug
()
{
if
(
has_rx_timer
)
{
cancel_timer
(
rx_timer_id
);
has_rx_timer
=
false
;
}
if
(
has_tx_timer
)
{
cancel_timer
(
tx_timer_id
);
has_tx_timer
=
false
;
}
rm_fd
(
handle
);
rm_fd
(
uplink_handle
);
rm_fd
(
rdata_notify_handle
);
...
...
@@ -128,10 +140,9 @@ void zmq::pgm_sender_t::in_event ()
has_rx_timer
=
false
;
}
// In
event on sender side means NAK or SPMR receiving from some peer.
// In
-
event on sender side means NAK or SPMR receiving from some peer.
pgm_socket
.
process_upstream
();
const
int
last_errno
=
errno
;
if
(
last_errno
==
ENOMEM
||
last_errno
==
EBUSY
)
{
if
(
errno
==
ENOMEM
||
errno
==
EBUSY
)
{
const
long
timeout
=
pgm_socket
.
get_rx_timeout
();
add_timer
(
timeout
,
rx_timer_id
);
has_rx_timer
=
true
;
...
...
src/pgm_sender.hpp
View file @
b64b50ae
...
...
@@ -66,7 +66,8 @@ namespace zmq
enum
{
tx_timer_id
=
0xa0
,
rx_timer_id
=
0xa1
};
// Timers are running.
bool
has_tx_timer
,
has_rx_timer
;
bool
has_tx_timer
;
bool
has_rx_timer
;
// Message encoder.
encoder_t
encoder
;
...
...
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