diff --git a/relay/client/client.go b/relay/client/client.go index a0d5124dc..4a20a3b00 100644 --- a/relay/client/client.go +++ b/relay/client/client.go @@ -402,11 +402,13 @@ func (c *Client) writeTo(connReference *Conn, id string, dstID []byte, payload [ log.Errorf("failed to marshal transport message: %s", err) return 0, err } - n, err := c.relayConn.Write(msg) + + // the write always return with 0 length because the underling does not support the size feedback. + _, err = c.relayConn.Write(msg) if err != nil { log.Errorf("failed to write transport message: %s", err) } - return n, err + return len(payload), err } func (c *Client) listenForStopEvents(hc *healthcheck.Receiver, conn net.Conn, internalStopFlag *internalStopFlag) { diff --git a/relay/client/dialer/ws/conn.go b/relay/client/dialer/ws/conn.go index 188582964..e7f771b8d 100644 --- a/relay/client/dialer/ws/conn.go +++ b/relay/client/dialer/ws/conn.go @@ -38,7 +38,7 @@ func (c *Conn) Read(b []byte) (n int, err error) { func (c *Conn) Write(b []byte) (n int, err error) { err = c.Conn.Write(c.ctx, websocket.MessageBinary, b) - return len(b), err + return 0, err } func (c *Conn) RemoteAddr() net.Addr {