Adds preliminary signaling to iostream transport of eof and fatal transport errors

This commit is contained in:
Peter Thorson
2013-09-27 21:24:33 -05:00
parent e6319f51a4
commit c175ec4f42
2 changed files with 32 additions and 0 deletions

View File

@@ -1,4 +1,6 @@
HEAD
- Adds preliminary signaling to iostream transport of eof and fatal transport
errors
- Updates transport code to use shared pointers rather than raw pointers to
prevent asio from retaining pointers to connection methods after the
connection goes out of scope. #293 Thank you otaras for reporting.

View File

@@ -142,6 +142,36 @@ public:
return this->readsome_impl(buf,len);
}
/// Signal EOF
/**
* Signals to the transport that data stream being read has reached EOF and
* that no more bytes may be read or written to/from the transport.
*/
void eof() {
// this serializes calls to external read.
scoped_lock_type lock(m_read_mutex);
if (m_reading) {
m_reading = false;
m_read_handler(make_error_code(transport::error::eof), m_cursor);
}
}
/// Signal transport error
/**
* Signals to the transport that a fatal data stream error has occurred and
* that no more bytes may be read or written to/from the transport.
*/
void fatal_error() {
// this serializes calls to external read.
scoped_lock_type lock(m_read_mutex);
if (m_reading) {
m_reading = false;
m_read_handler(make_error_code(transport::error::pass_through), m_cursor);
}
}
/// Set whether or not this connection is secure
/**
* The iostream transport does not provide any security features. As such