mirror of https://github.com/schollz/croc.git
use single variable for buffer size
This commit is contained in:
parent
c9dab1ca44
commit
8797d35fa1
|
@ -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.
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue