add state

This commit is contained in:
Zack Scholl 2018-10-14 18:26:18 -07:00
parent 3bed0bc8bf
commit 55d9137b6d
2 changed files with 5 additions and 0 deletions

View File

@ -50,6 +50,8 @@ type Croc struct {
// is using local relay
isLocal bool
normalFinish bool
State string
}
// Init will initiate with the default parameters

View File

@ -180,6 +180,7 @@ func (cr *Croc) send(forceSend int, serverAddress string, tcpPorts []string, isL
c.WriteMessage(websocket.BinaryMessage, P.Bytes())
// start PAKE spinnner
spin.Suffix = " performing PAKE..."
cr.State = "Performing PAKE..."
spin.Start()
case 2:
// P recieves H(k),v from Q
@ -195,6 +196,7 @@ func (cr *Croc) send(forceSend int, serverAddress string, tcpPorts []string, isL
// wait for readiness
spin.Stop()
spin.Suffix = " waiting for recipient ok..."
cr.State = "Waiting for recipient ok...."
spin.Start()
case 3:
log.Debugf("[%d] recipient declares readiness for file info", step)
@ -379,6 +381,7 @@ func (cr *Croc) send(forceSend int, serverAddress string, tcpPorts []string, isL
return data.err
}
bar.Add(data.bytesRead)
// write data to websockets
err = c.WriteMessage(websocket.BinaryMessage, data.b)
if err != nil {