From 4c0600f324a10a59cf505b991e687d9888fa3a16 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Mon, 31 Mar 2008 10:44:10 +0000 Subject: Prevent broker exit on receiving connection with invalid protocol version. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@642959 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/AsynchIOAcceptor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/sys/AsynchIOAcceptor.cpp b/cpp/src/qpid/sys/AsynchIOAcceptor.cpp index f74541d29a..6502885ed0 100644 --- a/cpp/src/qpid/sys/AsynchIOAcceptor.cpp +++ b/cpp/src/qpid/sys/AsynchIOAcceptor.cpp @@ -27,6 +27,7 @@ #include "Thread.h" #include "qpid/sys/ConnectionOutputHandler.h" +#include "qpid/framing/AMQP_HighestVersion.h" #include "qpid/framing/reply_exceptions.h" #include "qpid/framing/ProtocolInitiation.h" #include "qpid/log/Statement.h" @@ -247,10 +248,11 @@ void AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) { QPID_LOG(debug, "RECV [" << identifier << "] INIT(" << protocolInit << ")"); codec = factory->create(protocolInit.getVersion(), *this, identifier); if (!codec) { - // FIXME aconway 2008-03-18: send valid version header & close connection. - // FIXME aconway 2008-03-18: exception type - throw Exception( - QPID_MSG("Protocol version not supported: " << protocolInit)); + //TODO: may still want to revise this... + //send valid version header & close connection. + write(framing::ProtocolInitiation(framing::highestProtocolVersion)); + readError = true; + aio->queueWriteClose(); } } } -- cgit v1.2.1