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
8d85638f
Commit
8d85638f
authored
Nov 26, 2009
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
memory leak in message encoder fixed
parent
92aa9e94
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
7 deletions
+17
-7
AUTHORS
AUTHORS
+1
-0
local_thr.c
perf/c/local_thr.c
+3
-0
session.cpp
src/session.cpp
+0
-4
zmq_decoder.cpp
src/zmq_decoder.cpp
+7
-1
zmq_encoder.cpp
src/zmq_encoder.cpp
+6
-1
zmq_listener_init.cpp
src/zmq_listener_init.cpp
+0
-1
No files found.
AUTHORS
View file @
8d85638f
...
...
@@ -9,6 +9,7 @@ Dirk O. Kaar
Erich Heine
Frank Denis
George Neill
Jon Dyte
Martin Hurton
Martin Lucina
Martin Sustrik
...
...
perf/c/local_thr.c
View file @
8d85638f
...
...
@@ -79,6 +79,9 @@ int main (int argc, char *argv [])
if
(
elapsed
==
0
)
elapsed
=
1
;
rc
=
zmq_msg_close
(
&
msg
);
assert
(
rc
==
0
);
throughput
=
(
unsigned
long
)
((
double
)
message_count
/
(
double
)
elapsed
*
1000000
);
megabits
=
(
double
)
(
throughput
*
message_size
*
8
)
/
1000000
;
...
...
src/session.cpp
View file @
8d85638f
...
...
@@ -51,10 +51,6 @@ bool zmq::session_t::read (::zmq_msg_t *msg_)
bool
zmq
::
session_t
::
write
(
::
zmq_msg_t
*
msg_
)
{
// The communication is unidirectional.
// We don't expect any message to arrive.
zmq_assert
(
out_pipe
);
if
(
out_pipe
->
write
(
msg_
))
{
zmq_msg_init
(
msg_
);
return
true
;
...
...
src/zmq_decoder.cpp
View file @
8d85638f
...
...
@@ -51,6 +51,9 @@ bool zmq::zmq_decoder_t::one_byte_size_ready ()
else
{
// TODO: Handle over-sized message decently.
// in_progress is initialised at this point so in theory we should
// close it before calling zmq_msg_init_size, however, it's a 0-byte
// message and thus we can treat it as uninitialised...
int
rc
=
zmq_msg_init_size
(
&
in_progress
,
*
tmpbuf
);
errno_assert
(
rc
==
0
);
...
...
@@ -67,6 +70,9 @@ bool zmq::zmq_decoder_t::eight_byte_size_ready ()
size_t
size
=
(
size_t
)
get_uint64
(
tmpbuf
);
// TODO: Handle over-sized message decently.
// in_progress is initialised at this point so in theory we should
// close it before calling zmq_msg_init_size, however, it's a 0-byte
// message and thus we can treat it as uninitialised...
int
rc
=
zmq_msg_init_size
(
&
in_progress
,
size
);
errno_assert
(
rc
==
0
);
...
...
@@ -78,7 +84,7 @@ bool zmq::zmq_decoder_t::eight_byte_size_ready ()
bool
zmq
::
zmq_decoder_t
::
message_ready
()
{
// Message is completely read. Push it further and start reading
// new message.
// new message.
(in_progress is a 0-byte message after this point.)
if
(
!
destination
||
!
destination
->
write
(
&
in_progress
))
return
false
;
...
...
src/zmq_encoder.cpp
View file @
8d85638f
...
...
@@ -50,12 +50,17 @@ bool zmq::zmq_encoder_t::size_ready ()
bool
zmq
::
zmq_encoder_t
::
message_ready
()
{
// Destroy content of the old message.
zmq_msg_close
(
&
in_progress
);
// Read new message from the dispatcher. If there is none, return false.
// Note that new state is set only if write is successful. That way
// unsuccessful write will cause retry on the next state machine
// invocation.
if
(
!
source
||
!
source
->
read
(
&
in_progress
))
if
(
!
source
||
!
source
->
read
(
&
in_progress
))
{
zmq_msg_init
(
&
in_progress
);
return
false
;
}
size_t
size
=
zmq_msg_size
(
&
in_progress
);
...
...
src/zmq_listener_init.cpp
View file @
8d85638f
...
...
@@ -55,7 +55,6 @@ bool zmq::zmq_listener_init_t::write (::zmq_msg_t *msg_)
has_peer_identity
=
true
;
peer_identity
.
assign
((
const
char
*
)
zmq_msg_data
(
msg_
),
zmq_msg_size
(
msg_
));
return
true
;
}
...
...
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