* Enqueues a new request * @param {OperationState} operation * @param {Function} callback The write callback.
(operation, callback)
| 206 | * @param {Function} callback The write callback. |
| 207 | */ |
| 208 | push(operation, callback) { |
| 209 | const self = this; |
| 210 | |
| 211 | if (this.error) { |
| 212 | // There was a write error, there is no point in further trying to write to the socket. |
| 213 | return process.nextTick(function writePushError() { |
| 214 | callback(self.error); |
| 215 | }); |
| 216 | } |
| 217 | |
| 218 | this.queue.push({ operation: operation, callback: callback}); |
| 219 | this.run(); |
| 220 | } |
| 221 | |
| 222 | run() { |
| 223 | if (!this.isRunning && this.canWrite) { |
no test coverage detected