Skip to content

WriteControl() changes WriteDeadline permanently #841

@ayjayt

Description

@ayjayt

I will, later, dig out more information to support this.

https://github.com/gorilla/websocket/blob/9111bb834a68b893cebbbaed5060bdbc1d9ab7d2/conn.go#L463C4-L463C35

func (*Conn) WriteControl
func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) error
WriteControl writes a control message with the given deadline. The allowed message types are CloseMessage, PingMessage and PongMessage.

The issue here that the documentation implies that the deadline is set for this one message, whereas it actually calls SetWriteDeadline() and changes the deadline for all subsequent writes as well. It also uses a non-documented default value if supplied time zero &time.Time{} so you should expect this function to change your configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions