aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport/zero_copy.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-09 20:09:45 -0700
committerJosh Blum <josh@joshknows.com>2010-07-09 20:09:45 -0700
commitc898ca9751d1b274ae8f8f7afc2d5bc54b6ef30c (patch)
tree68608f738c82c43ba0ace42089011f51723afdd8 /host/lib/transport/zero_copy.cpp
parent75537e896bbd0aeb8d988b6ad33b5ab2d35b316f (diff)
downloaduhd-c898ca9751d1b274ae8f8f7afc2d5bc54b6ef30c.tar.gz
uhd-c898ca9751d1b274ae8f8f7afc2d5bc54b6ef30c.tar.bz2
uhd-c898ca9751d1b274ae8f8f7afc2d5bc54b6ef30c.zip
uhd: ssize_t for phony zero copy return types, null sptr for timeout/error with get managed buffers
Diffstat (limited to 'host/lib/transport/zero_copy.cpp')
-rw-r--r--host/lib/transport/zero_copy.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/host/lib/transport/zero_copy.cpp b/host/lib/transport/zero_copy.cpp
index 27f41329b..42f69d77b 100644
--- a/host/lib/transport/zero_copy.cpp
+++ b/host/lib/transport/zero_copy.cpp
@@ -71,7 +71,9 @@ managed_recv_buffer::sptr phony_zero_copy_recv_if::get_recv_buff(void){
boost::uint8_t *recv_mem = new boost::uint8_t[_impl->max_buff_size];
//call recv() with timeout option
- size_t num_bytes = this->recv(boost::asio::buffer(recv_mem, _impl->max_buff_size));
+ ssize_t num_bytes = this->recv(boost::asio::buffer(recv_mem, _impl->max_buff_size));
+
+ if (num_bytes <= 0) return managed_recv_buffer::sptr(); //NULL sptr
//create a new managed buffer to house the data
return managed_recv_buffer::sptr(
@@ -86,7 +88,7 @@ managed_recv_buffer::sptr phony_zero_copy_recv_if::get_recv_buff(void){
//! phony zero-copy send buffer implementation
class managed_send_buffer_impl : public managed_send_buffer{
public:
- typedef boost::function<size_t(const boost::asio::const_buffer &)> send_fcn_t;
+ typedef boost::function<ssize_t(const boost::asio::const_buffer &)> send_fcn_t;
managed_send_buffer_impl(
const boost::asio::mutable_buffer &buff,
@@ -102,8 +104,8 @@ public:
/* NOP */
}
- void commit(size_t num_bytes){
- _send_fcn(boost::asio::buffer(_buff, num_bytes));
+ ssize_t commit(size_t num_bytes){
+ return _send_fcn(boost::asio::buffer(_buff, num_bytes));
}
private: