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)
|
log.Error(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if bytes.Equal(message, []byte("magic")) {
|
||||||
|
log.Debug("got magic")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
// do decryption
|
// do decryption
|
||||||
var enc crypt.Encryption
|
var enc crypt.Encryption
|
||||||
|
@ -244,9 +248,9 @@ func receive(forceSend int, serverAddress, serverTCP string, isLocal bool, c *we
|
||||||
// update the progress bar
|
// update the progress bar
|
||||||
bar.Add(n)
|
bar.Add(n)
|
||||||
|
|
||||||
if int64(bytesWritten) == fstats.Size {
|
// if int64(bytesWritten) == fstats.Size {
|
||||||
break
|
// break
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
c.WriteMessage(websocket.BinaryMessage, []byte("done"))
|
c.WriteMessage(websocket.BinaryMessage, []byte("done"))
|
||||||
|
|
|
@ -224,6 +224,12 @@ func send(forceSend int, serverAddress, serverTCP string, isLocal bool, c *webso
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// finish
|
// finish
|
||||||
|
dataChan <- DataChan{
|
||||||
|
b: []byte("magic"),
|
||||||
|
bytesRead: len([]byte("magic")),
|
||||||
|
err: nil,
|
||||||
|
}
|
||||||
|
// finish
|
||||||
dataChan <- DataChan{
|
dataChan <- DataChan{
|
||||||
b: nil,
|
b: nil,
|
||||||
bytesRead: 0,
|
bytesRead: 0,
|
||||||
|
|
Loading…
Reference in New Issue