0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

increase size

This commit is contained in:
Zack Scholl 2018-09-26 06:57:52 -07:00
parent 1a7b123519
commit ea548f290c
2 changed files with 5 additions and 5 deletions

View file

@ -33,7 +33,7 @@ func (c Comm) Close() {
}
func (c Comm) Write(b []byte) (int, error) {
c.connection.Write([]byte(fmt.Sprintf("%0.8d", len(b))))
c.connection.Write([]byte(fmt.Sprintf("%0.6d", len(b))))
n, err := c.connection.Write(b)
if n != len(b) {
err = fmt.Errorf("wanted to write %d but wrote %d", n, len(b))
@ -43,8 +43,8 @@ func (c Comm) Write(b []byte) (int, error) {
}
func (c Comm) Read() (buf []byte, numBytes int, bs []byte, err error) {
// read until we get 8 bytes
tmp := make([]byte, 8)
// read until we get 6 bytes
tmp := make([]byte, 6)
n, err := c.connection.Read(tmp)
if err != nil {
return
@ -58,7 +58,7 @@ func (c Comm) Read() (buf []byte, numBytes int, bs []byte, err error) {
for {
// see if we have enough bytes
bs = bytes.Trim(bs, "\x00")
if len(bs) == 8 {
if len(bs) == 6 {
break
}
n, err := c.connection.Read(tmp)

View file

@ -1,4 +1,4 @@
package models
const WEBSOCKET_BUFFER_SIZE = 1024 * 1024 * 32
const TCP_BUFFER_SIZE = 1024 * 1024 * 32
const TCP_BUFFER_SIZE = 993280