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
17e2ca71
Commit
17e2ca71
authored
Feb 18, 2011
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Logging of duplicit identities added
Signed-off-by:
Martin Sustrik
<
sustrik@250bpm.com
>
parent
1f536b2d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
6 deletions
+20
-6
ctx.cpp
src/ctx.cpp
+10
-2
ctx.hpp
src/ctx.hpp
+2
-1
object.cpp
src/object.cpp
+6
-2
object.hpp
src/object.hpp
+1
-1
session.cpp
src/session.cpp
+1
-0
No files found.
src/ctx.cpp
View file @
17e2ca71
...
...
@@ -291,14 +291,22 @@ zmq::endpoint_t zmq::ctx_t::find_endpoint (const char *addr_)
return
*
endpoint
;
}
void
zmq
::
ctx_t
::
log
(
zmq_msg_t
*
msg
_
)
void
zmq
::
ctx_t
::
log
(
const
char
*
format_
,
va_list
args
_
)
{
// Create the log message.
zmq_msg_t
msg
;
int
rc
=
zmq_msg_init_size
(
&
msg
,
strlen
(
format_
)
+
1
);
zmq_assert
(
rc
==
0
);
memcpy
(
zmq_msg_data
(
&
msg
),
format_
,
zmq_msg_size
(
&
msg
));
// At this point we migrate the log socket to the current thread.
// We rely on mutex for executing the memory barrier.
log_sync
.
lock
();
if
(
log_socket
)
log_socket
->
send
(
msg_
,
0
);
log_socket
->
send
(
&
msg
,
0
);
log_sync
.
unlock
();
zmq_msg_close
(
&
msg
);
}
src/ctx.hpp
View file @
17e2ca71
...
...
@@ -23,6 +23,7 @@
#include <map>
#include <vector>
#include <string>
#include <stdarg.h>
#include "../include/zmq.h"
...
...
@@ -85,7 +86,7 @@ namespace zmq
endpoint_t
find_endpoint
(
const
char
*
addr_
);
// Logging.
void
log
(
zmq_msg_t
*
msg
_
);
void
log
(
const
char
*
format_
,
va_list
args
_
);
enum
{
term_tid
=
0
,
...
...
src/object.cpp
View file @
17e2ca71
...
...
@@ -18,6 +18,7 @@
*/
#include <string.h>
#include <stdarg.h>
#include "object.hpp"
#include "ctx.hpp"
...
...
@@ -151,9 +152,12 @@ void zmq::object_t::destroy_socket (socket_base_t *socket_)
ctx
->
destroy_socket
(
socket_
);
}
void
zmq
::
object_t
::
log
(
zmq_msg_t
*
msg_
)
void
zmq
::
object_t
::
log
(
const
char
*
format_
,
...
)
{
ctx
->
log
(
msg_
);
va_list
args
;
va_start
(
args
,
format_
);
ctx
->
log
(
format_
,
args
);
va_end
(
args
);
}
zmq
::
io_thread_t
*
zmq
::
object_t
::
choose_io_thread
(
uint64_t
affinity_
)
...
...
src/object.hpp
View file @
17e2ca71
...
...
@@ -52,7 +52,7 @@ namespace zmq
void
destroy_socket
(
class
socket_base_t
*
socket_
);
// Logs an message.
void
log
(
zmq_msg_t
*
msg_
);
void
log
(
const
char
*
format_
,
...
);
// Chooses least loaded I/O thread.
class
io_thread_t
*
choose_io_thread
(
uint64_t
affinity_
);
...
...
src/session.cpp
View file @
17e2ca71
...
...
@@ -234,6 +234,7 @@ void zmq::session_t::process_attach (i_engine *engine_,
// If the session already has an engine attached, destroy new one.
// Note new engine is not plugged in yet, we don't have to unplug it.
if
(
engine
)
{
log
(
"DPID: duplicate peer identity - disconnecting peer"
);
delete
engine_
;
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