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
46ed0920
Commit
46ed0920
authored
Aug 09, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various code style improvements
parent
53e9af71
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
22 deletions
+21
-22
pipe.cpp
src/pipe.cpp
+17
-18
pipe.hpp
src/pipe.hpp
+3
-3
trie.cpp
src/trie.cpp
+1
-1
No files found.
src/pipe.cpp
View file @
46ed0920
...
...
@@ -127,7 +127,7 @@ void zmq::pipe_t::set_server_socket_routing_id (
_server_socket_routing_id
=
server_socket_routing_id_
;
}
uint32_t
zmq
::
pipe_t
::
get_server_socket_routing_id
()
uint32_t
zmq
::
pipe_t
::
get_server_socket_routing_id
()
const
{
return
_server_socket_routing_id
;
}
...
...
@@ -138,7 +138,7 @@ void zmq::pipe_t::set_router_socket_routing_id (
_router_socket_routing_id
.
set_deep_copy
(
router_socket_routing_id_
);
}
const
zmq
::
blob_t
&
zmq
::
pipe_t
::
get_routing_id
()
const
zmq
::
blob_t
&
zmq
::
pipe_t
::
get_routing_id
()
const
{
return
_router_socket_routing_id
;
}
...
...
@@ -165,7 +165,7 @@ bool zmq::pipe_t::check_read ()
// initiate termination process.
if
(
_in_pipe
->
probe
(
is_delimiter
))
{
msg_t
msg
;
bool
ok
=
_in_pipe
->
read
(
&
msg
);
const
bool
ok
=
_in_pipe
->
read
(
&
msg
);
zmq_assert
(
ok
);
process_delimiter
();
return
false
;
...
...
@@ -218,7 +218,7 @@ bool zmq::pipe_t::check_write ()
if
(
unlikely
(
!
_out_active
||
_state
!=
active
))
return
false
;
bool
full
=
!
check_hwm
();
const
bool
full
=
!
check_hwm
();
if
(
unlikely
(
full
))
{
_out_active
=
false
;
...
...
@@ -233,7 +233,7 @@ bool zmq::pipe_t::write (msg_t *msg_)
if
(
unlikely
(
!
check_write
()))
return
false
;
bool
more
=
(
msg_
->
flags
()
&
msg_t
::
more
)
!=
0
;
const
bool
more
=
(
msg_
->
flags
()
&
msg_t
::
more
)
!=
0
;
const
bool
is_routing_id
=
msg_
->
is_routing_id
();
_out_pipe
->
write
(
*
msg_
,
more
);
if
(
!
more
&&
!
is_routing_id
)
...
...
@@ -242,14 +242,14 @@ bool zmq::pipe_t::write (msg_t *msg_)
return
true
;
}
void
zmq
::
pipe_t
::
rollback
()
void
zmq
::
pipe_t
::
rollback
()
const
{
// Remove incomplete message from the outbound pipe.
msg_t
msg
;
if
(
_out_pipe
)
{
while
(
_out_pipe
->
unwrite
(
&
msg
))
{
zmq_assert
(
msg
.
flags
()
&
msg_t
::
more
);
int
rc
=
msg
.
close
();
const
int
rc
=
msg
.
close
();
errno_assert
(
rc
==
0
);
}
}
...
...
@@ -294,7 +294,7 @@ void zmq::pipe_t::process_hiccup (void *pipe_)
while
(
_out_pipe
->
read
(
&
msg
))
{
if
(
!
(
msg
.
flags
()
&
msg_t
::
more
))
_msgs_written
--
;
int
rc
=
msg
.
close
();
const
int
rc
=
msg
.
close
();
errno_assert
(
rc
==
0
);
}
LIBZMQ_DELETE
(
_out_pipe
);
...
...
@@ -372,7 +372,7 @@ void zmq::pipe_t::process_pipe_term_ack ()
if
(
!
_conflate
)
{
msg_t
msg
;
while
(
_in_pipe
->
read
(
&
msg
))
{
int
rc
=
msg
.
close
();
const
int
rc
=
msg
.
close
();
errno_assert
(
rc
==
0
);
}
}
...
...
@@ -476,7 +476,7 @@ int zmq::pipe_t::compute_lwm (int hwm_)
// Given the 3. it would be good to keep HWM and LWM as far apart as
// possible to reduce the thread switching overhead to almost zero.
// Let's make LWM 1/2 of HWM.
int
result
=
(
hwm_
+
1
)
/
2
;
const
int
result
=
(
hwm_
+
1
)
/
2
;
return
result
;
}
...
...
@@ -502,20 +502,18 @@ void zmq::pipe_t::hiccup ()
// We'll drop the pointer to the inpipe. From now on, the peer is
// responsible for deallocating it.
_in_pipe
=
NULL
;
// Create new inpipe.
if
(
_conflate
)
_in_pipe
=
new
(
std
::
nothrow
)
ypipe_conflate_t
<
msg_t
>
();
else
_in_pipe
=
new
(
std
::
nothrow
)
ypipe_t
<
msg_t
,
message_pipe_granularity
>
();
_in_pipe
=
_conflate
?
static_cast
<
upipe_t
*>
(
new
(
std
::
nothrow
)
ypipe_conflate_t
<
msg_t
>
())
:
new
(
std
::
nothrow
)
ypipe_t
<
msg_t
,
message_pipe_granularity
>
();
alloc_assert
(
_in_pipe
);
_in_active
=
true
;
// Notify the peer about the hiccup.
send_hiccup
(
_peer
,
(
void
*
)
_in_pipe
);
send_hiccup
(
_peer
,
_in_pipe
);
}
void
zmq
::
pipe_t
::
set_hwms
(
int
inhwm_
,
int
outhwm_
)
...
...
@@ -542,7 +540,8 @@ void zmq::pipe_t::set_hwms_boost (int inhwmboost_, int outhwmboost_)
bool
zmq
::
pipe_t
::
check_hwm
()
const
{
bool
full
=
_hwm
>
0
&&
_msgs_written
-
_peers_msgs_read
>=
uint64_t
(
_hwm
);
const
bool
full
=
_hwm
>
0
&&
_msgs_written
-
_peers_msgs_read
>=
uint64_t
(
_hwm
);
return
(
!
full
);
}
...
...
src/pipe.hpp
View file @
46ed0920
...
...
@@ -86,11 +86,11 @@ class pipe_t : public object_t,
// Pipe endpoint can store an routing ID to be used by its clients.
void
set_server_socket_routing_id
(
uint32_t
routing_id_
);
uint32_t
get_server_socket_routing_id
();
uint32_t
get_server_socket_routing_id
()
const
;
// Pipe endpoint can store an opaque ID to be used by its clients.
void
set_router_socket_routing_id
(
const
blob_t
&
identity_
);
const
blob_t
&
get_routing_id
();
const
blob_t
&
get_routing_id
()
const
;
const
blob_t
&
get_credential
()
const
;
...
...
@@ -111,7 +111,7 @@ class pipe_t : public object_t,
bool
write
(
msg_t
*
msg_
);
// Remove unfinished parts of the outbound message from the pipe.
void
rollback
();
void
rollback
()
const
;
// Flush the messages downstream.
void
flush
();
...
...
src/trie.cpp
View file @
46ed0920
...
...
@@ -86,7 +86,7 @@ bool zmq::trie_t::add (unsigned char *prefix_, size_t size_)
unsigned
short
old_count
=
_count
;
_count
=
c
-
_min
+
1
;
_next
.
table
=
static_cast
<
trie_t
**>
(
realloc
(
(
void
*
)
_next
.
table
,
sizeof
(
trie_t
*
)
*
_count
));
realloc
(
_next
.
table
,
sizeof
(
trie_t
*
)
*
_count
));
zmq_assert
(
_next
.
table
);
for
(
unsigned
short
i
=
old_count
;
i
!=
_count
;
i
++
)
_next
.
table
[
i
]
=
NULL
;
...
...
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