(item, refed)
| 359 | // Appends a timer onto the end of an existing timers list, or creates a new |
| 360 | // list if one does not already exist for the specified timeout duration. |
| 361 | function insertGuarded(item, refed) { |
| 362 | const msecs = item._idleTimeout; |
| 363 | if (msecs < 0 || msecs === undefined) |
| 364 | return; |
| 365 | |
| 366 | insert(item, msecs); |
| 367 | |
| 368 | const isDestroyed = item._destroyed; |
| 369 | if (isDestroyed || !item[async_id_symbol]) { |
| 370 | item._destroyed = false; |
| 371 | initAsyncResource(item, 'Timeout'); |
| 372 | } |
| 373 | |
| 374 | if (isDestroyed) { |
| 375 | if (refed) |
| 376 | incRefCount(); |
| 377 | } else if (refed === !item[kRefed]) { |
| 378 | if (refed) |
| 379 | incRefCount(); |
| 380 | else |
| 381 | decRefCount(); |
| 382 | } |
| 383 | item[kRefed] = refed; |
| 384 | } |
| 385 | |
| 386 | // We need to use the binding as the receiver for fast API calls. |
| 387 | function insert(item, msecs, start = binding.getLibuvNow()) { |
no test coverage detected
searching dependent graphs…