()
| 74 | } |
| 75 | |
| 76 | async #run () { |
| 77 | this.#running = true |
| 78 | const queue = this.#queue |
| 79 | while (!queue.isEmpty()) { |
| 80 | const node = queue.shift() |
| 81 | // wait pending promise |
| 82 | if (node.promise !== null) { |
| 83 | await node.promise |
| 84 | } |
| 85 | // write |
| 86 | this.#socket.write(node.frame, node.callback) |
| 87 | // cleanup |
| 88 | node.callback = node.frame = null |
| 89 | } |
| 90 | this.#running = false |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | function createFrame (data, hint) { |