mirror of https://github.com/schollz/croc.git
introduce magic bytes to stop
This commit is contained in:
parent
ee7518c7bd
commit
75f7cdcf65
|
@ -216,6 +216,10 @@ func receive(forceSend int, serverAddress, serverTCP string, isLocal bool, c *we
|
|||
log.Error(err)
|
||||
return err
|
||||
}
|
||||
if bytes.Equal(message, []byte("magic")) {
|
||||
log.Debug("got magic")
|
||||
break
|
||||
}
|
||||
|
||||
// do decryption
|
||||
var enc crypt.Encryption
|
||||
|
@ -244,9 +248,9 @@ func receive(forceSend int, serverAddress, serverTCP string, isLocal bool, c *we
|
|||
// update the progress bar
|
||||
bar.Add(n)
|
||||
|
||||
if int64(bytesWritten) == fstats.Size {
|
||||
break
|
||||
}
|
||||
// if int64(bytesWritten) == fstats.Size {
|
||||
// break
|
||||
// }
|
||||
}
|
||||
|
||||
c.WriteMessage(websocket.BinaryMessage, []byte("done"))
|
||||
|
|
|
@ -224,6 +224,12 @@ func send(forceSend int, serverAddress, serverTCP string, isLocal bool, c *webso
|
|||
}
|
||||
}
|
||||
// finish
|
||||
dataChan <- DataChan{
|
||||
b: []byte("magic"),
|
||||
bytesRead: len([]byte("magic")),
|
||||
err: nil,
|
||||
}
|
||||
// finish
|
||||
dataChan <- DataChan{
|
||||
b: nil,
|
||||
bytesRead: 0,
|
||||
|
|
Loading…
Reference in New Issue