mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
log ice state
This commit is contained in:
parent
336b78eeeb
commit
af173327b8
1 changed files with 11 additions and 0 deletions
|
@ -404,6 +404,8 @@ func (c *Client) CreateOfferer(finished chan<- error) (pc *webrtc.PeerConnection
|
|||
break
|
||||
}
|
||||
}
|
||||
msg, _ := box.Bundle(fstat.Size(), c.Key)
|
||||
sendData([]byte(msg))
|
||||
if pos == 0 {
|
||||
log.Debug("transfering file")
|
||||
}
|
||||
|
@ -452,6 +454,7 @@ func (c *Client) CreateOfferer(finished chan<- error) (pc *webrtc.PeerConnection
|
|||
sendMoreCh <- struct{}{}
|
||||
})
|
||||
|
||||
var fileSize int64
|
||||
// Register the OnMessage to handle incoming messages
|
||||
dc.OnMessage(func(dcMsg webrtc.DataChannelMessage) {
|
||||
var fd FileData
|
||||
|
@ -478,6 +481,14 @@ func (c *Client) CreateOfferer(finished chan<- error) (pc *webrtc.PeerConnection
|
|||
readyToEnd = true
|
||||
return
|
||||
}
|
||||
if fileSize == 0 {
|
||||
err = box.Unbundle(string(dcMsg.Data), c.Key, &fileSize)
|
||||
if err != nil {
|
||||
fileSize = 0
|
||||
} else {
|
||||
log.Debugf("receiving file sized %d", fileSize)
|
||||
}
|
||||
}
|
||||
err = box.Unbundle(string(dcMsg.Data), c.Key, &fd)
|
||||
if err == nil {
|
||||
// log.Debug(fd.Position)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue