startReceiveLoop starts datagramReceiveLoop with a given quic.Connection, first checking if it already has been started.
(conn quic.Connection)
| 287 | // startReceiveLoop starts datagramReceiveLoop with a given quic.Connection, first checking |
| 288 | // if it already has been started. |
| 289 | func (c *Client) startReceiveLoop(conn quic.Connection) error { |
| 290 | c.logger.Info("startReceiveLoop", "conn", conn) |
| 291 | c.mutex.Lock() |
| 292 | defer c.mutex.Unlock() |
| 293 | if c.receiveLoopStarted { |
| 294 | return nil |
| 295 | } |
| 296 | |
| 297 | ctx, cancel := context.WithCancel(context.Background()) |
| 298 | c.datagramCtx = ctx |
| 299 | c.datagramCancel = cancel |
| 300 | |
| 301 | go c.datagramReceiveLoop(conn) |
| 302 | |
| 303 | c.receiveLoopStarted = true |
| 304 | return nil |
| 305 | } |
| 306 | |
| 307 | func (c *Client) cancelAllUDPStreams() error { |
| 308 | streamList := []*DatagramStream{} |
no test coverage detected