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
a46980ba
Commit
a46980ba
authored
Dec 15, 2010
by
Mikko Koppanen
Committed by
Martin Sustrik
Dec 15, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove assertions from devices
Signed-off-by:
Mikko Koppanen
<
mkoppanen@php.net
>
parent
f749f2d2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
25 deletions
+26
-25
zmq_forwarder.cpp
devices/zmq_forwarder/zmq_forwarder.cpp
+5
-1
zmq_queue.cpp
devices/zmq_queue/zmq_queue.cpp
+5
-1
zmq_streamer.cpp
devices/zmq_streamer/zmq_streamer.cpp
+5
-1
device.cpp
src/device.cpp
+11
-22
No files found.
devices/zmq_forwarder/zmq_forwarder.cpp
View file @
a46980ba
...
...
@@ -113,7 +113,11 @@ int main (int argc, char *argv [])
n
++
;
}
zmq
::
device
(
ZMQ_FORWARDER
,
in_socket
,
out_socket
);
try
{
zmq
::
device
(
ZMQ_FORWARDER
,
in_socket
,
out_socket
);
}
catch
(
zmq
::
error_t
&
e
)
{
fprintf
(
stderr
,
"device exit: %s
\n
"
,
e
.
what
());
}
return
0
;
}
devices/zmq_queue/zmq_queue.cpp
View file @
a46980ba
...
...
@@ -112,7 +112,11 @@ int main (int argc, char *argv [])
n
++
;
}
zmq
::
device
(
ZMQ_QUEUE
,
in_socket
,
out_socket
);
try
{
zmq
::
device
(
ZMQ_QUEUE
,
in_socket
,
out_socket
);
}
catch
(
zmq
::
error_t
&
e
)
{
fprintf
(
stderr
,
"device exit: %s
\n
"
,
e
.
what
());
}
return
0
;
}
devices/zmq_streamer/zmq_streamer.cpp
View file @
a46980ba
...
...
@@ -112,7 +112,11 @@ int main (int argc, char *argv [])
n
++
;
}
zmq
::
device
(
ZMQ_FORWARDER
,
in_socket
,
out_socket
);
try
{
zmq
::
device
(
ZMQ_STREAMER
,
in_socket
,
out_socket
);
}
catch
(
zmq
::
error_t
&
e
)
{
fprintf
(
stderr
,
"device exit: %s
\n
"
,
e
.
what
());
}
return
0
;
}
src/device.cpp
View file @
a46980ba
...
...
@@ -31,7 +31,10 @@ int zmq::device (class socket_base_t *insocket_,
{
zmq_msg_t
msg
;
int
rc
=
zmq_msg_init
(
&
msg
);
zmq_assert
(
rc
==
0
);
if
(
rc
!=
0
)
{
return
-
1
;
}
int64_t
more
;
size_t
moresz
;
...
...
@@ -51,9 +54,7 @@ int zmq::device (class socket_base_t *insocket_,
// Wait while there are either requests or replies to process.
rc
=
zmq_poll
(
&
items
[
0
],
2
,
-
1
);
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
return
-
1
;
errno_assert
(
false
);
return
-
1
;
}
// The algorithm below asumes ratio of request and replies processed
...
...
@@ -67,24 +68,18 @@ int zmq::device (class socket_base_t *insocket_,
rc
=
insocket_
->
recv
(
&
msg
,
0
);
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
return
-
1
;
errno_assert
(
false
);
return
-
1
;
}
moresz
=
sizeof
(
more
);
rc
=
insocket_
->
getsockopt
(
ZMQ_RCVMORE
,
&
more
,
&
moresz
);
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
return
-
1
;
errno_assert
(
false
);
return
-
1
;
}
rc
=
outsocket_
->
send
(
&
msg
,
more
?
ZMQ_SNDMORE
:
0
);
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
return
-
1
;
errno_assert
(
false
);
return
-
1
;
}
if
(
!
more
)
...
...
@@ -98,24 +93,18 @@ int zmq::device (class socket_base_t *insocket_,
rc
=
outsocket_
->
recv
(
&
msg
,
0
);
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
return
-
1
;
errno_assert
(
false
);
return
-
1
;
}
moresz
=
sizeof
(
more
);
rc
=
outsocket_
->
getsockopt
(
ZMQ_RCVMORE
,
&
more
,
&
moresz
);
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
return
-
1
;
errno_assert
(
false
);
return
-
1
;
}
rc
=
insocket_
->
send
(
&
msg
,
more
?
ZMQ_SNDMORE
:
0
);
if
(
unlikely
(
rc
<
0
))
{
if
(
errno
==
ETERM
)
return
-
1
;
errno_assert
(
false
);
return
-
1
;
}
if
(
!
more
)
...
...
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