From 4274737d8315848edc4fa0ccb534482202ce5658 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Mon, 8 Jun 2009 14:34:45 +0000 Subject: Plumbed in an a connection abort operation to the OutputHandler git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@782649 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/AsynchIOHandler.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'cpp/src/qpid/sys/AsynchIOHandler.cpp') diff --git a/cpp/src/qpid/sys/AsynchIOHandler.cpp b/cpp/src/qpid/sys/AsynchIOHandler.cpp index 6b7e7b5145..9da4a68381 100644 --- a/cpp/src/qpid/sys/AsynchIOHandler.cpp +++ b/cpp/src/qpid/sys/AsynchIOHandler.cpp @@ -7,9 +7,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -26,6 +26,8 @@ #include "qpid/framing/ProtocolInitiation.h" #include "qpid/log/Statement.h" +#include + namespace qpid { namespace sys { @@ -75,6 +77,10 @@ void AsynchIOHandler::write(const framing::ProtocolInitiation& data) aio->queueWrite(buff); } +void AsynchIOHandler::abort() { + aio->requestCallback(boost::bind(&AsynchIOHandler::eof, this, _1)); +} + void AsynchIOHandler::activateOutput() { aio->notifyPendingWrite(); } @@ -120,7 +126,7 @@ bool AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) { //send valid version header & close connection. write(framing::ProtocolInitiation(framing::highestProtocolVersion)); readError = true; - aio->queueWriteClose(); + aio->queueWriteClose(); } } catch (const std::exception& e) { QPID_LOG(error, e.what()); @@ -163,7 +169,7 @@ void AsynchIOHandler::eof(AsynchIO&) { } void AsynchIOHandler::closedSocket(AsynchIO&, const Socket& s) { - // If we closed with data still to send log a warning + // If we closed with data still to send log a warning if (!aio->writeQueueEmpty()) { QPID_LOG(warning, "CLOSING [" << identifier << "] unsent data (probably due to client disconnect)"); } @@ -198,7 +204,7 @@ void AsynchIOHandler::idle(AsynchIO&){ aio->queueWrite(buff); } if (codec->isClosed()) - aio->queueWriteClose(); + aio->queueWriteClose(); } catch (const std::exception& e) { QPID_LOG(error, e.what()); aio->queueWriteClose(); -- cgit v1.2.1