From 3035c8dc0a791419e72a20bc819bdb677eefa673 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Sat, 28 Sep 2013 07:55:41 -0500 Subject: [PATCH] Deprecates iostream transport `readsome` in favor of `read_some` which is more consistent with the naming of the rest of the library. --- changelog.md | 2 ++ examples/iostream_server/iostream_server.cpp | 2 +- websocketpp/transport/iostream/connection.hpp | 26 +++++++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 7d065fca76..214fca4021 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,6 @@ HEAD +- Deprecates iostream transport `readsome` in favor of `read_some` which is more + consistent with the naming of the rest of the library. - Adds preliminary signaling to iostream transport of eof and fatal transport errors - Updates transport code to use shared pointers rather than raw pointers to diff --git a/examples/iostream_server/iostream_server.cpp b/examples/iostream_server/iostream_server.cpp index 617631369c..f44e6c1020 100644 --- a/examples/iostream_server/iostream_server.cpp +++ b/examples/iostream_server/iostream_server.cpp @@ -77,7 +77,7 @@ int main() { } else { char a; while(std::cin.get(a)) { - con->readsome(&a,1); + con->read_some(&a,1); } } } catch (const std::exception & e) { diff --git a/websocketpp/transport/iostream/connection.hpp b/websocketpp/transport/iostream/connection.hpp index 1984b2b5de..1fe9f7879e 100644 --- a/websocketpp/transport/iostream/connection.hpp +++ b/websocketpp/transport/iostream/connection.hpp @@ -132,14 +132,30 @@ public: * Copies bytes from buf into WebSocket++'s input buffers. Bytes will be * copied from the supplied buffer to fulfill any pending library reads. It * will return the number of bytes successfully processed. If there are no - * pending reads readsome will return immediately. Not all of the bytes may + * pending reads read_some will return immediately. Not all of the bytes may * be able to be read in one call + * + * + * @since 0.3.0-alpha4 + * + * @param buf Char buffer to read into the websocket + * @param len Length of buf + * @return The number of characters from buf actually read. */ - size_t readsome(char const * buf, size_t len) { + size_t read_some(char const * buf, size_t len) { // this serializes calls to external read. scoped_lock_type lock(m_read_mutex); - return this->readsome_impl(buf,len); + return this->read_some_impl(buf,len); + } + + /// Manual input supply (DEPRECATED) + /** + * @deprecated DEPRECATED in favor of read_some() + * @see read_some() + */ + size_t readsome(char const * buf, size_t len) { + return this->read_some(buf,len); } /// Signal EOF @@ -453,8 +469,8 @@ private: } } - size_t readsome_impl(char const * buf, size_t len) { - m_alog.write(log::alevel::devel,"iostream_con readsome"); + size_t read_some_impl(char const * buf, size_t len) { + m_alog.write(log::alevel::devel,"iostream_con read_some"); if (!m_reading) { m_elog.write(log::elevel::devel,"write while not reading");