(ctx context.Context, opcode opcode, p []byte)
| 274 | } |
| 275 | |
| 276 | func (c *Conn) writeControl(ctx context.Context, opcode opcode, p []byte) error { |
| 277 | ctx, cancel := context.WithTimeout(ctx, time.Second*5) |
| 278 | defer cancel() |
| 279 | |
| 280 | _, err := c.writeFrame(ctx, true, false, opcode, p) |
| 281 | if err != nil { |
| 282 | return fmt.Errorf("failed to write control frame %v: %w", opcode, err) |
| 283 | } |
| 284 | return nil |
| 285 | } |
| 286 | |
| 287 | // writeFrame handles all writes to the connection. |
| 288 | func (c *Conn) writeFrame(ctx context.Context, fin bool, flate bool, opcode opcode, p []byte) (_ int, err error) { |
no test coverage detected