From 598af2576c98e45161ca21662434423f349958cc Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 20 Jul 2015 18:50:29 +0000 Subject: Added a close function. It's nice to be able to close your connection whenever you want to. --- src/stable/protocoltelnet.cpp | 6 ++++++ src/stable/protocoltelnet.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/stable/protocoltelnet.cpp b/src/stable/protocoltelnet.cpp index 9cf2a7b..77bc3dc 100644 --- a/src/stable/protocoltelnet.cpp +++ b/src/stable/protocoltelnet.cpp @@ -339,6 +339,12 @@ void Bu::ProtocolTelnet::flush() pClient->flush(); } +void Bu::ProtocolTelnet::close() +{ + Bu::MutexLocker l( mWrite ); + pClient->close(); +} + void Bu::ProtocolTelnet::onWill( char cCode ) { Bu::MutexLocker l( mWrite ); diff --git a/src/stable/protocoltelnet.h b/src/stable/protocoltelnet.h index 19298dc..efc8889 100644 --- a/src/stable/protocoltelnet.h +++ b/src/stable/protocoltelnet.h @@ -125,6 +125,7 @@ namespace Bu void write( const char *pData, int iSize ); void write( char cData ); void flush(); + void close(); const Bu::String &getBuffer() { return sDataBuf; } -- cgit v1.2.3