Skip to content

Commit

Permalink
tealdbg: increase intermediate reading/writing buffers (#3335)
Browse files Browse the repository at this point in the history
## Summary

Some large teal source files cause the tealdbg/cdt session to choke.  Upping the buffer size to allow for larger source files.

closes #3100 

## Test Plan

Run tealdbg with a large source teal file, ensure the source file makes it to cdt without choking.
  • Loading branch information
barnjamin authored Dec 20, 2021
1 parent 22a5ebb commit 0ad9900
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cmd/tealdbg/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,22 @@ import (
"github.com/gorilla/mux"
)

const (
// 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

// 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
)

var upgrader = websocket.Upgrader{
ReadBufferSize: 20480,
WriteBufferSize: 20480,
ReadBufferSize: WebSocketReadBufferSize,
WriteBufferSize: WebSocketWriteBufferSize,
CheckOrigin: func(r *http.Request) bool {
if len(r.Header.Get("Origin")) == 0 {
return true
Expand Down

0 comments on commit 0ad9900

Please sign in to comment.