(ctx context.Context)
| 369 | } |
| 370 | |
| 371 | func (p *Peer) Close(ctx context.Context) { |
| 372 | p.t.Helper() |
| 373 | p.cancel() |
| 374 | for { |
| 375 | select { |
| 376 | case <-ctx.Done(): |
| 377 | p.t.Errorf("timeout waiting for responses to close for %s", p.name) |
| 378 | return |
| 379 | case _, ok := <-p.resps: |
| 380 | if ok { |
| 381 | continue |
| 382 | } |
| 383 | return |
| 384 | } |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | func (p *Peer) UngracefulDisconnect(ctx context.Context) { |
| 389 | p.t.Helper() |