mirror of https://github.com/schollz/croc.git
update
This commit is contained in:
parent
768fc3b8b6
commit
f23ce6e246
|
@ -421,14 +421,9 @@ func (c *Client) CreateOfferer(finished chan<- error) (pc *webrtc.PeerConnection
|
||||||
}
|
}
|
||||||
log.Debug(float64(fstat.Size()) / float64(time.Since(timeStart).Seconds()) / 1000000)
|
log.Debug(float64(fstat.Size()) / float64(time.Since(timeStart).Seconds()) / 1000000)
|
||||||
|
|
||||||
sendData([]byte{1, 2, 3})
|
|
||||||
time.Sleep(100 * time.Millisecond)
|
|
||||||
sendData([]byte{1, 2, 3})
|
|
||||||
time.Sleep(100 * time.Millisecond)
|
|
||||||
sendData([]byte{1, 2, 3})
|
|
||||||
time.Sleep(100 * time.Millisecond)
|
|
||||||
for {
|
for {
|
||||||
time.Sleep(10 * time.Millisecond)
|
sendData([]byte{1, 2, 3})
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
if readyToEnd {
|
if readyToEnd {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -457,6 +452,9 @@ func (c *Client) CreateOfferer(finished chan<- error) (pc *webrtc.PeerConnection
|
||||||
// Register the OnMessage to handle incoming messages
|
// Register the OnMessage to handle incoming messages
|
||||||
dc.OnMessage(func(dcMsg webrtc.DataChannelMessage) {
|
dc.OnMessage(func(dcMsg webrtc.DataChannelMessage) {
|
||||||
var fd FileData
|
var fd FileData
|
||||||
|
if len(dcMsg.Data) >= 3 {
|
||||||
|
log.Debugf("%+x", dcMsg.Data[:3])
|
||||||
|
}
|
||||||
if bytes.Equal(dcMsg.Data, []byte{1, 2, 3}) {
|
if bytes.Equal(dcMsg.Data, []byte{1, 2, 3}) {
|
||||||
log.Debug("received magic")
|
log.Debug("received magic")
|
||||||
fwrite.Close()
|
fwrite.Close()
|
||||||
|
|
Loading…
Reference in New Issue