diff --git a/src/Makefile b/src/Makefile index d57f373..f5ac510 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,14 +1,14 @@ -CPP = g++-4.8 -RM = rm -f +CPP = g++ +RM = rm -f CPPFLAGS = -Wall -c -I. -O2 -flto -std=c++11 -g -LD = g++ +LD = g++ LD_FLAGS = -Wall -shared -O2 -RESULT = libcopernica_amqp.so +RESULT = libamqp++.so STATIC = $(RESULT:%.so=%.a) SOURCES = $(wildcard *.cpp) OBJECTS = $(SOURCES:%.cpp=%.o) -OBJECTS_STATIC = $(SOURCES:%.cpp=%.s.o) +OBJECTS_STATIC = $(SOURCES:%.cpp=%.s.o) all: ${OBJECTS} ${OBJECTS_STATIC} ${RESULT} $(MAKE) STATIC_LIB diff --git a/src/channelimpl.cpp b/src/channelimpl.cpp index 475ab92..8af4389 100644 --- a/src/channelimpl.cpp +++ b/src/channelimpl.cpp @@ -50,7 +50,7 @@ ChannelImpl::ChannelImpl(Channel *parent, Connection *connection, ChannelHandler _state = state_closed; // invalid id, this channel can not exist - handler->onChannelError(_parent, "Max number of channels reached"); + handler->onError(_parent, "Max number of channels reached"); } else { diff --git a/src/connectionimpl.cpp b/src/connectionimpl.cpp index e63e654..35d3b47 100644 --- a/src/connectionimpl.cpp +++ b/src/connectionimpl.cpp @@ -15,6 +15,29 @@ */ namespace AMQP { +/** + * Construct an AMQP object based on full login data + * + * The first parameter is a handler object. This handler class is + * an interface that should be implemented by the caller. + * + * Note that the constructor is private to ensure that nobody can construct + * this class, only the real Connection class via a friend construct + * + * @param parent Parent connection object + * @param handler Connection handler + * @param login Login data + */ +ConnectionImpl::ConnectionImpl(Connection *parent, ConnectionHandler *handler, const Login &login, const std::string &vhost) : + _parent(parent), _handler(handler), _login(login), _vhost(vhost) +{ + // we need a protocol header + ProtocolHeaderFrame header; + + // send out the protocol header + send(header); +} + /** * Destructor */ @@ -27,18 +50,6 @@ ConnectionImpl::~ConnectionImpl() close(); } -/** - * Initialize the connection - */ -void ConnectionImpl::initialize() -{ - // we need a protocol header - ProtocolHeaderFrame header; - - // send out the protocol header - send(header); -} - /** * Add a channel to the connection, and return the channel ID that it * is allowed to use, or 0 when no more ID's are available diff --git a/src/connectiontuneframe.cpp b/src/connectiontuneframe.cpp index 43f4b95..1752684 100644 --- a/src/connectiontuneframe.cpp +++ b/src/connectiontuneframe.cpp @@ -33,7 +33,7 @@ bool ConnectionTuneFrame::process(ConnectionImpl *connection) connection->send(okframe); // and finally we start to open the frame - ConnectionOpenFrame openframe(connection->login().vhost()); + ConnectionOpenFrame openframe(connection->vhost()); // send the open frame connection->send(openframe);