-
Notifications
You must be signed in to change notification settings - Fork 371
Description
I'm implementing a client which connects via TLS (using the software versions listed below). During testing, the TLS handshake succeeds, but the AMQP portion of the handshake fails. While attempting to establish the connection, the AMQP header ("AMQP0091") is successfully sent by the client, and the server replies with a Connection.Start message. At this point, the client is supposed to reply with a Connection.Start-Ok message, but it does not do so.
The data is being generated (connectionstartframe.h), and the connection is set to send the ConnectionStartOKFrame. I followed the path through the following:
ConnectionStartFrame::process
ConnectionImpl::send
PassthroughBuffer::flush
TcpConnection::onData
SslConnected::send
In SslConnected::send, _handler->monitor is called with (readable | writable), but the write never occurs and the connection times out.
The workaround I've used is to call write in the SslConnected::send function, right before the call to _handler->monitor:
virtual void send(const char *buffer, size_t size) override
{
...
Monitor monitor(this);
write(monitor); // flush(monitor) works as well
// comment...
_handler->monitor(_connection, _socket, readable | writable);
}
This "works"; the AMQP handshake succeeds, and data is sent and received in the client via TLS. I don't like this solution, as I assume the Monitor should be tracking the Connection object, not SslConnected. I'm also concerned about edge cases around the handling of the output buffer, and SSL error messages like SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE. I have a solution that adds a monitor object to the send call of every TcpState object, in the event that any of those state objects need to monitor the connection. If this sounds reasonable, I can issue a pull request.
What I'm using:
OS Version: CentOS 7.4
AMQP-CPP Version: AMQP-CPP Master (as of April 2, 2018)
openssl Version: 1.0.2k
RabbitMQ Version: 3.7.2
Event Handler: libboostasio.h