Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Fix node-ldapjs#329 #773

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1273,11 +1273,18 @@ Client.prototype._sendSocket = function _sendSocket (message,
log.trace('sending request %j', message.json)

try {
return conn.write(message.toBer(), writeCallback)
if (expect === 'unbind') {
return conn.write(message.toBer(), writeCallback)
} else {
writeCallback()
return conn.write(message.toBer())
}
Comment on lines 1275 to +1281
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a minimum we should have a comment here that explains why this code is the way it is. This would at least allow us to accept it without a test, as I know there is difficult code in this project. However, we really should be able to force the condition in our unit tests somehow.

} catch (e) {
if (timer) { clearTimeout(timer) }

log.trace({ err: e }, 'Error writing message to socket')
emitter.emit('error', e)

return callback(e)
}
}
Expand Down