mirror of
https://github.com/schollz/croc.git
synced 2024-11-30 23:52:07 +03:00
add state
This commit is contained in:
parent
3bed0bc8bf
commit
55d9137b6d
@ -50,6 +50,8 @@ type Croc struct {
|
|||||||
// is using local relay
|
// is using local relay
|
||||||
isLocal bool
|
isLocal bool
|
||||||
normalFinish bool
|
normalFinish bool
|
||||||
|
|
||||||
|
State string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init will initiate with the default parameters
|
// Init will initiate with the default parameters
|
||||||
|
@ -180,6 +180,7 @@ func (cr *Croc) send(forceSend int, serverAddress string, tcpPorts []string, isL
|
|||||||
c.WriteMessage(websocket.BinaryMessage, P.Bytes())
|
c.WriteMessage(websocket.BinaryMessage, P.Bytes())
|
||||||
// start PAKE spinnner
|
// start PAKE spinnner
|
||||||
spin.Suffix = " performing PAKE..."
|
spin.Suffix = " performing PAKE..."
|
||||||
|
cr.State = "Performing PAKE..."
|
||||||
spin.Start()
|
spin.Start()
|
||||||
case 2:
|
case 2:
|
||||||
// P recieves H(k),v from Q
|
// 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
|
// wait for readiness
|
||||||
spin.Stop()
|
spin.Stop()
|
||||||
spin.Suffix = " waiting for recipient ok..."
|
spin.Suffix = " waiting for recipient ok..."
|
||||||
|
cr.State = "Waiting for recipient ok...."
|
||||||
spin.Start()
|
spin.Start()
|
||||||
case 3:
|
case 3:
|
||||||
log.Debugf("[%d] recipient declares readiness for file info", step)
|
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
|
return data.err
|
||||||
}
|
}
|
||||||
bar.Add(data.bytesRead)
|
bar.Add(data.bytesRead)
|
||||||
|
|
||||||
// write data to websockets
|
// write data to websockets
|
||||||
err = c.WriteMessage(websocket.BinaryMessage, data.b)
|
err = c.WriteMessage(websocket.BinaryMessage, data.b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user