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