diff options
author | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-03-14 14:18:16 +0000 |
---|---|---|
committer | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-03-14 14:18:16 +0000 |
commit | 70d08263890346b944c15d721943c6ff35957198 (patch) | |
tree | ee2c555ae194094586c0e64ff24c47553f59a578 /protocols | |
parent | 3d25b918bb08ab8ebafe5b7e28f2056e85c39df3 (diff) | |
download | ATCD-70d08263890346b944c15d721943c6ff35957198.tar.gz |
ChangeLogTag: Mon Mar 14 16:32:08 2005 Boris Kolpackov <boris@kolpackov.net>
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/ace/RMCast/Socket.cpp | 29 | ||||
-rw-r--r-- | protocols/ace/RMCast/Socket.h | 6 |
2 files changed, 35 insertions, 0 deletions
diff --git a/protocols/ace/RMCast/Socket.cpp b/protocols/ace/RMCast/Socket.cpp index 79c40defd67..21e43c07f47 100644 --- a/protocols/ace/RMCast/Socket.cpp +++ b/protocols/ace/RMCast/Socket.cpp @@ -37,6 +37,9 @@ namespace ACE_RMCast size_t recv_ (void* buf, size_t s); + size_t + size_ (); + private: virtual void recv (Message_ptr m); @@ -137,6 +140,26 @@ namespace ACE_RMCast return r; } + size_t Socket_Impl:: + size_ () + { + Lock l (mutex_); + + while (queue_.is_empty ()) cond_.wait (); + + // I can't get the head of the queue without actually dequeuing + // the element. + // + Message_ptr m; + if (queue_.dequeue_head (m) == -1) abort (); + if (queue_.enqueue_head (m) == -1) abort (); + + Data const* d = static_cast<Data const*>(m->find (Data::id)); + + return d->size (); + } + + void Socket_Impl:: recv (Message_ptr m) { @@ -187,4 +210,10 @@ namespace ACE_RMCast { return impl_->recv_ (buf, s); } + + size_t Socket:: + size () + { + return impl_->size_ (); + } } diff --git a/protocols/ace/RMCast/Socket.h b/protocols/ace/RMCast/Socket.h index e2631659132..3fe68d2604c 100644 --- a/protocols/ace/RMCast/Socket.h +++ b/protocols/ace/RMCast/Socket.h @@ -32,6 +32,12 @@ namespace ACE_RMCast virtual size_t recv (void* buf, size_t s); + // Retrun the size of the next message. Block if message is + // not available. + // + virtual size_t + size (); + private: ACE_Auto_Ptr<Socket_Impl> impl_; }; |