1
0
mirror of https://github.com/schollz/croc.git synced 2024-12-11 06:35:01 +03:00

change buffer size

This commit is contained in:
Zack Scholl 2018-09-22 09:34:38 -07:00
parent b469d5db4b
commit 73791a4dc7
3 changed files with 8 additions and 6 deletions

View File

@ -19,7 +19,7 @@ const (
pingPeriod = (pongWait * 9) / 10
// Maximum message size allowed from peer.
maxMessageSize = 1024 * 1024 * 1
maxMessageSize = 1024 * 1024 * 16
)
var upgrader = websocket.Upgrader{

View File

@ -69,11 +69,13 @@ func (h *hub) run() {
case s := <-h.unregister:
// if one leaves, close all of them
h.rooms.Lock()
for connection := range h.rooms.rooms[s.room] {
close(connection.send)
if _, ok := h.rooms.rooms[s.room]; ok {
for connection := range h.rooms.rooms[s.room] {
close(connection.send)
}
log.Debugf("deleting room %s", s.room)
delete(h.rooms.rooms, s.room)
}
log.Debugf("deleting room %s", s.room)
delete(h.rooms.rooms, s.room)
h.rooms.Unlock()
case m := <-h.broadcast:
h.rooms.Lock()

View File

@ -157,7 +157,7 @@ func send(c *websocket.Conn, fname string, codephrase string) (err error) {
fmt.Fprintf(os.Stderr, "Sending...\n")
// send file, compure hash simultaneously
buffer := make([]byte, 1024*512)
buffer := make([]byte, 1024*1024*8)
bar := progressbar.NewOptions(
int(fstats.Size),
progressbar.OptionSetRenderBlankState(true),