log ice state

This commit is contained in:
Zack Scholl 2019-11-13 09:12:56 -08:00
parent 336b78eeeb
commit af173327b8
1 changed files with 11 additions and 0 deletions

View File

@ -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)