From de21e3cc02bc07e488d13d6d8188a446c5f03c04 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Mon, 20 Dec 2021 06:42:55 -0500 Subject: [PATCH 1/3] up buffer size for tealdbg --- cmd/tealdbg/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/tealdbg/server.go b/cmd/tealdbg/server.go index 43335921fc..e2b0fec736 100644 --- a/cmd/tealdbg/server.go +++ b/cmd/tealdbg/server.go @@ -31,8 +31,8 @@ import ( ) var upgrader = websocket.Upgrader{ - ReadBufferSize: 20480, - WriteBufferSize: 20480, + ReadBufferSize: 20480 * 4, + WriteBufferSize: 20480 * 4, CheckOrigin: func(r *http.Request) bool { if len(r.Header.Get("Origin")) == 0 { return true From f7c3cbb489d13ffba29de5f56343299761e32fe7 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Mon, 20 Dec 2021 08:42:23 -0500 Subject: [PATCH 2/3] adding absolute value and comments with reasoning --- cmd/tealdbg/server.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/tealdbg/server.go b/cmd/tealdbg/server.go index e2b0fec736..4cdd715505 100644 --- a/cmd/tealdbg/server.go +++ b/cmd/tealdbg/server.go @@ -30,9 +30,18 @@ import ( "github.com/gorilla/mux" ) +const ( + // WebSocketBufferSize is the size of the buffer for the + // tealdbg/cdt websocket session. + // A buffer that is too small will cause the session to choke + // during the `getScriptSource` call and the session cannot recover. + WebSocketReadBufferSize = 81920 + WebSocketWriteBufferSize = 81920 +) + var upgrader = websocket.Upgrader{ - ReadBufferSize: 20480 * 4, - WriteBufferSize: 20480 * 4, + ReadBufferSize: WebSocketReadBufferSize, + WriteBufferSize: WebSocketWriteBufferSize, CheckOrigin: func(r *http.Request) bool { if len(r.Header.Get("Origin")) == 0 { return true From 0d0e4c31e4bdddfcaa864b824e563280af58567c Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Mon, 20 Dec 2021 08:50:10 -0500 Subject: [PATCH 3/3] good review dog --- cmd/tealdbg/server.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/tealdbg/server.go b/cmd/tealdbg/server.go index 4cdd715505..d4c3213e0f 100644 --- a/cmd/tealdbg/server.go +++ b/cmd/tealdbg/server.go @@ -31,11 +31,15 @@ import ( ) const ( - // WebSocketBufferSize is the size of the buffer for the + // WebSocketReadBufferSize is the size of the ReadBuffer for the // tealdbg/cdt websocket session. // A buffer that is too small will cause the session to choke // during the `getScriptSource` call and the session cannot recover. - WebSocketReadBufferSize = 81920 + WebSocketReadBufferSize = 81920 + + // WebSocketWriteBufferSize is the size of the WriteBuffer for the + // tealdbg/cdt websocket session. + // The reasoning for the size is the same as above WebSocketWriteBufferSize = 81920 )