(msecs, callback)
| 234 | } |
| 235 | |
| 236 | function setStreamTimeout(msecs, callback) { |
| 237 | if (this.destroyed) |
| 238 | return this; |
| 239 | |
| 240 | this.timeout = msecs; |
| 241 | |
| 242 | // Type checking identical to timers.enroll() |
| 243 | msecs = getTimerDuration(msecs, 'msecs'); |
| 244 | |
| 245 | // Attempt to clear an existing timer in both cases - |
| 246 | // even if it will be rescheduled we don't want to leak an existing timer. |
| 247 | clearTimeout(this[kTimeout]); |
| 248 | |
| 249 | if (msecs === 0) { |
| 250 | if (callback !== undefined) { |
| 251 | validateFunction(callback, 'callback'); |
| 252 | this.removeListener('timeout', callback); |
| 253 | } |
| 254 | } else { |
| 255 | this[kTimeout] = setUnrefTimeout(this._onTimeout.bind(this), msecs); |
| 256 | if (this[kSession]) this[kSession][kUpdateTimer](); |
| 257 | if (this[kBoundSession]) this[kBoundSession][kUpdateTimer](); |
| 258 | |
| 259 | if (callback !== undefined) { |
| 260 | validateFunction(callback, 'callback'); |
| 261 | this.once('timeout', callback); |
| 262 | } |
| 263 | } |
| 264 | return this; |
| 265 | } |
| 266 | |
| 267 | module.exports = { |
| 268 | writevGeneric, |
nothing calls this directly
no test coverage detected
searching dependent graphs…