Skip to content

Commit

Permalink
fix(connection): use connectPolicy not this.policy.connect
Browse files Browse the repository at this point in the history
The most recent refactor for SASL properly extracted the connect
policy provided to the AMQPClient, and modified that value when
making decisions about the chosen SASL strategy. The codebase
previously had modified the passed in policy directly (incorrectly)
leading to invalid values being used for the initial open frame
sent out.
  • Loading branch information
mbroadst committed Oct 7, 2016
1 parent 1ef4e17 commit 3a1d4a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/amqp_client.js
Expand Up @@ -132,7 +132,7 @@ AMQPClient.prototype.connect = function(url, policyOverrides) {
connectPolicy.options.hostname = address.vhost;
}

self._connection = self._newConnection();
self._connection = self._newConnection(connectPolicy);
self._connection.on(Connection.Connected, function(c) {
debug('connected');
self.emit(AMQPClient.ConnectionOpened);
Expand Down Expand Up @@ -359,9 +359,9 @@ AMQPClient.prototype._clearConnectionState = function(saveReconnectDetails) {
};

// Helper methods for mocking in tests.
AMQPClient.prototype._newConnection = function() {
AMQPClient.prototype._newConnection = function(connectPolicy) {
var self = this;
var connection = new Connection(this.policy.connect);
var connection = new Connection(connectPolicy);
connection.on(Connection.ErrorReceived, function(e) {
debug('connection error: ', e);
self.emit(AMQPClient.ErrorReceived, e);
Expand Down

0 comments on commit 3a1d4a3

Please sign in to comment.