good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit e2016acc authored by Anmol Sethi's avatar Anmol Sethi
Browse files

Merge branch 'dev'

parents b4e4f4f1 454aee86
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ const ( ...@@ -42,7 +42,7 @@ const (
// Conn provides a wrapper around the browser WebSocket API. // Conn provides a wrapper around the browser WebSocket API.
type Conn struct { type Conn struct {
noCopy noCopy noCopy noCopy
ws wsjs.WebSocket ws wsjs.WebSocket
// read limit for a message in bytes. // read limit for a message in bytes.
msgReadLimit xsync.Int64 msgReadLimit xsync.Int64
...@@ -138,7 +138,8 @@ func (c *Conn) Read(ctx context.Context) (MessageType, []byte, error) { ...@@ -138,7 +138,8 @@ func (c *Conn) Read(ctx context.Context) (MessageType, []byte, error) {
if err != nil { if err != nil {
return 0, nil, fmt.Errorf("failed to read: %w", err) return 0, nil, fmt.Errorf("failed to read: %w", err)
} }
if int64(len(p)) > c.msgReadLimit.Load() { readLimit := c.msgReadLimit.Load()
if readLimit >= 0 && int64(len(p)) > readLimit {
err := fmt.Errorf("read limited at %v bytes", c.msgReadLimit.Load()) err := fmt.Errorf("read limited at %v bytes", c.msgReadLimit.Load())
c.Close(StatusMessageTooBig, err.Error()) c.Close(StatusMessageTooBig, err.Error())
return 0, nil, err return 0, nil, err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment