use single variable for buffer size

This commit is contained in:
Zack Scholl 2018-09-23 06:27:59 -07:00
parent c9dab1ca44
commit 8797d35fa1
2 changed files with 5 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import (
log "github.com/cihub/seelog"
"github.com/gorilla/websocket"
"github.com/schollz/croc/src/models"
)
const (
@ -19,12 +20,12 @@ const (
pingPeriod = (pongWait * 9) / 10
// Maximum message size allowed from peer.
maxMessageSize = 1024 * 1024 * 16
maxMessageSize = models.WEBSOCKET_BUFFER_SIZE / 2
)
var upgrader = websocket.Upgrader{
ReadBufferSize: 1024 * 1024 * 32,
WriteBufferSize: 1024 * 1024 * 32,
ReadBufferSize: models.WEBSOCKET_BUFFER_SIZE,
WriteBufferSize: models.WEBSOCKET_BUFFER_SIZE,
}
// connection is an middleman between the websocket connection and the hub.

View File

@ -194,7 +194,7 @@ func send(isLocal bool, c *websocket.Conn, fname string, codephrase string, useC
fmt.Fprintf(os.Stderr, "\rSending (->%s)...\n", otherIP)
// send file, compure hash simultaneously
startTransfer = time.Now()
buffer := make([]byte, 1024*1024*8)
buffer := make([]byte, models.WEBSOCKET_BUFFER_SIZE/8)
bar := progressbar.NewOptions(
int(fstats.Size),
progressbar.OptionSetRenderBlankState(true),