()
| 522 | } |
| 523 | |
| 524 | func (q *frameQueue) pop() (CopilotWebSocketMessage, bool) { |
| 525 | q.mu.Lock() |
| 526 | defer q.mu.Unlock() |
| 527 | for len(q.items) == 0 && !q.done { |
| 528 | q.cond.Wait() |
| 529 | } |
| 530 | if len(q.items) > 0 { |
| 531 | m := q.items[0] |
| 532 | q.items = q.items[1:] |
| 533 | return m, true |
| 534 | } |
| 535 | return CopilotWebSocketMessage{}, false |
| 536 | } |
| 537 | |
| 538 | type pendingExchange struct { |
| 539 | mu sync.Mutex |
no outgoing calls