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
5d4f6b18
Commit
5d4f6b18
authored
Mar 01, 2010
by
Martin Hurton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement flow control for ZMQ_P2P sockets
parent
f9521c6b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
p2p.cpp
src/p2p.cpp
+15
-6
p2p.hpp
src/p2p.hpp
+1
-0
No files found.
src/p2p.cpp
View file @
5d4f6b18
...
...
@@ -47,6 +47,7 @@ void zmq::p2p_t::xattach_pipes (class reader_t *inpipe_,
zmq_assert
(
!
inpipe
&&
!
outpipe
);
inpipe
=
inpipe_
;
outpipe
=
outpipe_
;
outpipe_alive
=
true
;
}
void
zmq
::
p2p_t
::
xdetach_inpipe
(
class
reader_t
*
pipe_
)
...
...
@@ -75,7 +76,8 @@ void zmq::p2p_t::xrevive (class reader_t *pipe_)
void
zmq
::
p2p_t
::
xrevive
(
class
writer_t
*
pipe_
)
{
zmq_not_implemented
();
zmq_assert
(
!
outpipe_alive
);
outpipe_alive
=
true
;
}
int
zmq
::
p2p_t
::
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
...
...
@@ -87,13 +89,17 @@ int zmq::p2p_t::xsetsockopt (int option_, const void *optval_,
int
zmq
::
p2p_t
::
xsend
(
zmq_msg_t
*
msg_
,
int
flags_
)
{
if
(
!
outpipe
)
{
if
(
outpipe
==
NULL
||
!
outpipe_alive
)
{
errno
=
EAGAIN
;
return
-
1
;
}
if
(
!
outpipe
->
write
(
msg_
))
{
outpipe_alive
=
false
;
errno
=
EAGAIN
;
return
-
1
;
}
bool
written
=
outpipe
->
write
(
msg_
);
zmq_assert
(
written
);
if
(
!
(
flags_
&
ZMQ_NOFLUSH
))
outpipe
->
flush
();
...
...
@@ -132,7 +138,10 @@ bool zmq::p2p_t::xhas_in ()
bool
zmq
::
p2p_t
::
xhas_out
()
{
// TODO: Implement this once queue limits are in-place.
return
true
;
if
(
outpipe
==
NULL
||
!
outpipe_alive
)
return
false
;
outpipe_alive
=
outpipe
->
check_write
();
return
outpipe_alive
;
}
src/p2p.hpp
View file @
5d4f6b18
...
...
@@ -53,6 +53,7 @@ namespace zmq
class
writer_t
*
outpipe
;
bool
alive
;
bool
outpipe_alive
;
p2p_t
(
const
p2p_t
&
);
void
operator
=
(
const
p2p_t
&
);
...
...
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