Changes
This commit is contained in:
15
node_modules/mongodb/lib/cmap/connection.js
generated
vendored
15
node_modules/mongodb/lib/cmap/connection.js
generated
vendored
@@ -4,6 +4,7 @@ const EventEmitter = require('events');
|
||||
const MessageStream = require('./message_stream');
|
||||
const MongoError = require('../core/error').MongoError;
|
||||
const MongoNetworkError = require('../core/error').MongoNetworkError;
|
||||
const MongoNetworkTimeoutError = require('../core/error').MongoNetworkTimeoutError;
|
||||
const MongoWriteConcernError = require('../core/error').MongoWriteConcernError;
|
||||
const CommandResult = require('../core/connection/command_result');
|
||||
const StreamDescription = require('./stream_description').StreamDescription;
|
||||
@@ -77,10 +78,14 @@ class Connection extends EventEmitter {
|
||||
stream.destroy();
|
||||
this.closed = true;
|
||||
this[kQueue].forEach(op =>
|
||||
op.cb(new MongoNetworkError(`connection ${this.id} to ${this.address} timed out`))
|
||||
op.cb(
|
||||
new MongoNetworkTimeoutError(`connection ${this.id} to ${this.address} timed out`, {
|
||||
beforeHandshake: this[kIsMaster] == null
|
||||
})
|
||||
)
|
||||
);
|
||||
this[kQueue].clear();
|
||||
|
||||
this[kQueue].clear();
|
||||
this.emit('close');
|
||||
});
|
||||
|
||||
@@ -218,6 +223,7 @@ function messageHandler(conn) {
|
||||
}
|
||||
|
||||
const operationDescription = conn[kQueue].get(message.responseTo);
|
||||
const callback = operationDescription.cb;
|
||||
|
||||
// SERVER-45775: For exhaust responses we should be able to use the same requestId to
|
||||
// track response, however the server currently synthetically produces remote requests
|
||||
@@ -226,10 +232,7 @@ function messageHandler(conn) {
|
||||
if (message.moreToCome) {
|
||||
// requeue the callback for next synthetic request
|
||||
conn[kQueue].set(message.requestId, operationDescription);
|
||||
}
|
||||
|
||||
const callback = operationDescription.cb;
|
||||
if (operationDescription.socketTimeoutOverride) {
|
||||
} else if (operationDescription.socketTimeoutOverride) {
|
||||
conn[kStream].setTimeout(conn.socketTimeout);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user