diff options
Diffstat (limited to 'Swiften/Network/DummyConnection.h')
-rw-r--r-- | Swiften/Network/DummyConnection.h | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/Swiften/Network/DummyConnection.h b/Swiften/Network/DummyConnection.h index d1657d5..576965f 100644 --- a/Swiften/Network/DummyConnection.h +++ b/Swiften/Network/DummyConnection.h @@ -15,32 +15,35 @@ #include "Swiften/EventLoop/EventOwner.h" namespace Swift { - class DummyConnection : - public Connection, - public EventOwner, - public boost::enable_shared_from_this<DummyConnection> { + class DummyConnection : public Connection, public EventOwner, public boost::enable_shared_from_this<DummyConnection> { + public: + void listen() { + assert(false); + } - void listen() { - assert(false); - } + void connect(const HostAddressPort&) { + assert(false); + } - void connect(const HostAddressPort&) { - assert(false); - } + void disconnect() { + //assert(false); + } - void disconnect() { - assert(false); - } + void write(const ByteArray& data) { + MainEventLoop::postEvent(boost::ref(onDataWritten), shared_from_this()); + onDataSent(data); + } - void write(const ByteArray& data) { - onDataWritten(data); - } + void receive(const ByteArray& data) { + MainEventLoop::postEvent(boost::bind(boost::ref(onDataRead), ByteArray(data)), shared_from_this()); + } - void receive(const ByteArray& data) { - MainEventLoop::postEvent(boost::bind( - boost::ref(onDataRead), ByteArray(data)), shared_from_this()); - } + HostAddressPort getLocalAddress() const { + return localAddress; + } - boost::signal<void (const ByteArray&)> onDataWritten; + boost::signal<void (const ByteArray&)> onDataSent; + + HostAddressPort localAddress; }; } |