(c)
| 400 | } |
| 401 | |
| 402 | function onopen(c) { |
| 403 | if (queries.length === 0) |
| 404 | return move(c, open) |
| 405 | |
| 406 | let max = Math.ceil(queries.length / (connecting.length + 1)) |
| 407 | , ready = true |
| 408 | |
| 409 | while (ready && queries.length && max-- > 0) { |
| 410 | const query = queries.shift() |
| 411 | if (query.reserve) |
| 412 | return query.reserve(c) |
| 413 | |
| 414 | ready = c.execute(query) |
| 415 | } |
| 416 | |
| 417 | ready |
| 418 | ? move(c, busy) |
| 419 | : move(c, full) |
| 420 | } |
| 421 | |
| 422 | function onclose(c, e) { |
| 423 | move(c, closed) |