diff options
author | Martin Braun <martin.braun@ettus.com> | 2016-09-05 11:47:55 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-09-05 11:47:55 -0700 |
commit | bb95d96ad8cdcdb3f12ef62231c1b0f9dcd7ebfd (patch) | |
tree | 4eb7fc68e2e04c6e47d68629a3e147bed65ddd2b /host/lib/transport | |
parent | 2262316abdfcb0cbe7c4a99290d85e1da84811e8 (diff) | |
parent | 83912104a9c1ab3631f755a4d98ee86e195db690 (diff) | |
download | uhd-bb95d96ad8cdcdb3f12ef62231c1b0f9dcd7ebfd.tar.gz uhd-bb95d96ad8cdcdb3f12ef62231c1b0f9dcd7ebfd.tar.bz2 uhd-bb95d96ad8cdcdb3f12ef62231c1b0f9dcd7ebfd.zip |
Merge branch 'maint'
Diffstat (limited to 'host/lib/transport')
-rw-r--r-- | host/lib/transport/udp_simple.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/host/lib/transport/udp_simple.cpp b/host/lib/transport/udp_simple.cpp index 347373c71..43414feaa 100644 --- a/host/lib/transport/udp_simple.cpp +++ b/host/lib/transport/udp_simple.cpp @@ -114,9 +114,13 @@ public: do{ //drain anything in current buffer while (_off < _len){ - const char ch = _buf[_off]; _off++; - line += std::string(1, ch); - if (ch == '\n' or ch == '\r') return line; + const char ch = _buf[_off++]; + _line += ch; + if (ch == '\n') + { + line.swap(_line); + return line; + } } //recv a new packet into the buffer @@ -131,6 +135,7 @@ private: udp_simple::sptr _udp; size_t _len, _off; boost::uint8_t _buf[udp_simple::mtu]; + std::string _line; }; uhd::uart_iface::sptr udp_simple::make_uart(sptr udp){ |