0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

file stuff ready

This commit is contained in:
Zack Scholl 2018-06-29 20:16:15 -07:00
parent 0bf384dd82
commit 98374c31cd
2 changed files with 13 additions and 0 deletions

View file

@ -204,6 +204,15 @@ func (c *Croc) processState(ws *websocket.Conn, cd channelData) (err error) {
c.cs.channel.Update = false c.cs.channel.Update = false
} }
} }
if c.cs.channel.Role == 0 && c.cs.channel.Pake.IsVerified() {
go func() {
// encrypt the files
// TODO
c.cs.Lock()
c.cs.channel.fileReady = true
c.cs.Unlock()
}()
}
// TODO // TODO
// process the client state // process the client state
@ -277,6 +286,9 @@ func (c *Croc) dialUp() (err error) {
for { for {
c.cs.RLock() c.cs.RLock()
ready := c.cs.channel.TransferReady ready := c.cs.channel.TransferReady
if role == 0 {
ready = ready && c.cs.channel.fileReady
}
c.cs.RUnlock() c.cs.RUnlock()
if ready { if ready {
break break

View file

@ -103,6 +103,7 @@ type channelData struct {
// sessionKey // sessionKey
sessionKey []byte sessionKey []byte
isReady bool isReady bool
fileReady bool
// relay parameters // relay parameters
// isopen determine whether or not the channel has been opened // isopen determine whether or not the channel has been opened