mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Adds preliminary signaling to iostream transport of eof and fatal transport errors
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user