mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
reduce number of packets
This commit is contained in:
parent
fdfa7f209d
commit
66a37ae5b2
1 changed files with 2 additions and 4 deletions
|
@ -32,11 +32,9 @@ func (c Comm) Close() {
|
|||
c.connection.Close()
|
||||
}
|
||||
|
||||
|
||||
func (c Comm) Write(b []byte) (int, error) {
|
||||
c.connection.Write([]byte(fmt.Sprintf("%0.5d", len(b))))
|
||||
n, err := c.connection.Write(b)
|
||||
if n != len(b) {
|
||||
n, err := c.connection.Write(append([]byte(fmt.Sprintf("%0.5d", len(b))), b...))
|
||||
if n != len(b)+5 {
|
||||
err = fmt.Errorf("wanted to write %d but wrote %d", n, len(b))
|
||||
}
|
||||
// log.Printf("wanted to write %d but wrote %d", n, len(b))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue