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
f27eb67e
Commit
f27eb67e
authored
Feb 01, 2013
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #510 from miniway/master
LIBZMQ-497 there could be unsent bytes in encoder
parents
a3ae0d4c
2c1a3c55
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
0 deletions
+19
-0
encoder.hpp
src/encoder.hpp
+5
-0
i_encoder.hpp
src/i_encoder.hpp
+1
-0
stream_engine.cpp
src/stream_engine.cpp
+12
-0
stream_engine.hpp
src/stream_engine.hpp
+1
-0
No files found.
src/encoder.hpp
View file @
f27eb67e
...
...
@@ -126,6 +126,11 @@ namespace zmq
*
size_
=
pos
;
}
inline
bool
has_data
()
{
return
to_write
>
0
;
}
protected
:
// Prototype of state machine action.
...
...
src/i_encoder.hpp
View file @
f27eb67e
...
...
@@ -47,6 +47,7 @@ namespace zmq
virtual
void
get_data
(
unsigned
char
**
data_
,
size_t
*
size_
,
int
*
offset_
=
NULL
)
=
0
;
virtual
bool
has_data
()
=
0
;
};
}
...
...
src/stream_engine.cpp
View file @
f27eb67e
...
...
@@ -65,6 +65,7 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_, cons
options
(
options_
),
endpoint
(
endpoint_
),
plugged
(
false
),
terminating
(
false
),
socket
(
NULL
)
{
// Put the socket into non-blocking mode.
...
...
@@ -188,6 +189,11 @@ void zmq::stream_engine_t::unplug ()
void
zmq
::
stream_engine_t
::
terminate
()
{
if
(
!
terminating
&&
encoder
&&
encoder
->
has_data
())
{
// Give io_thread a chance to send in the buffer
terminating
=
true
;
return
;
}
unplug
();
delete
this
;
}
...
...
@@ -298,6 +304,8 @@ void zmq::stream_engine_t::out_event ()
// this is necessary to prevent losing incomming messages.
if
(
nbytes
==
-
1
)
{
reset_pollout
(
handle
);
if
(
unlikely
(
terminating
))
terminate
();
return
;
}
...
...
@@ -309,6 +317,10 @@ void zmq::stream_engine_t::out_event ()
if
(
unlikely
(
handshaking
))
if
(
outsize
==
0
)
reset_pollout
(
handle
);
if
(
unlikely
(
terminating
))
if
(
outsize
==
0
)
terminate
();
}
void
zmq
::
stream_engine_t
::
activate_out
()
...
...
src/stream_engine.hpp
View file @
f27eb67e
...
...
@@ -135,6 +135,7 @@ namespace zmq
std
::
string
endpoint
;
bool
plugged
;
bool
terminating
;
// Socket
zmq
::
socket_base_t
*
socket
;
...
...
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