close stops the server and returns the requests it saw, in order. It waits for TLS handshakes still under way, so a rejected certificate is logged.
()
| 94 | // close stops the server and returns the requests it saw, in order. It waits |
| 95 | // for TLS handshakes still under way, so a rejected certificate is logged. |
| 96 | func (m *mockServer) close() []loggedRequest { |
| 97 | m.mu.Lock() |
| 98 | m.closing = true |
| 99 | m.mu.Unlock() |
| 100 | _ = m.srv.Close() |
| 101 | m.handshakes.Wait() |
| 102 | if m.tunnelSrv != nil { |
| 103 | _ = m.tunnelSrv.Close() |
| 104 | _ = m.tunnels.Close() |
| 105 | } |
| 106 | m.handlers.Wait() |
| 107 | m.mu.Lock() |
| 108 | defer m.mu.Unlock() |
| 109 | return append([]loggedRequest(nil), m.requests...) |
| 110 | } |
| 111 | |
| 112 | // discard forgets the requests and response positions recorded so far, such as |
| 113 | // anything gh did while printing its version. |