diff options
author | Josh Blum <josh@joshknows.com> | 2010-02-12 18:07:55 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-02-12 18:07:55 -0800 |
commit | 9fff25f4e5da179ea29ff44278e0415a337870cb (patch) | |
tree | cfbee4cf2921fd4bd415e3af1c1d466f79bab3d7 /lib/transport | |
parent | 350f5c5decca20a54132867283448fd32226bbc2 (diff) | |
download | uhd-9fff25f4e5da179ea29ff44278e0415a337870cb.tar.gz uhd-9fff25f4e5da179ea29ff44278e0415a337870cb.tar.bz2 uhd-9fff25f4e5da179ea29ff44278e0415a337870cb.zip |
Added a templated dictionary class because its more useful than map.
Made the device addrs into a string:string dict.
If its all strings we dont have to change the top level caller for new product.
Created shared_iovec class to manage memory for device recvs.
Work on the bro/dude control protocol for usrp2.
Diffstat (limited to 'lib/transport')
-rw-r--r-- | lib/transport/udp.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/transport/udp.cpp b/lib/transport/udp.cpp index f42ddcb75..06defb107 100644 --- a/lib/transport/udp.cpp +++ b/lib/transport/udp.cpp @@ -53,15 +53,15 @@ void uhd::transport::udp::send(const boost::asio::const_buffer &buff){ send(buffs); } -boost::asio::const_buffer uhd::transport::udp::recv(void){ - size_t len = 0; - //recv if data is available - if (_socket->available()){ - len = _socket->receive_from( - boost::asio::buffer(_recv_buff, sizeof(_recv_buff)), +uhd::shared_iovec uhd::transport::udp::recv(void){ + //allocate a buffer for the number of bytes available (could be zero) + uhd::shared_iovec iov(_socket->available()); + //call recv only if data is available + if (iov.len != 0){ + _socket->receive_from( + boost::asio::buffer(iov.base, iov.len), _sender_endpoint ); } - //return the buffer with the received length - return boost::asio::buffer(_recv_buff, len); + return iov; } |