From 55d9137b6dd3880b2b20c7fd2af3cd220db59158 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sun, 14 Oct 2018 18:26:18 -0700 Subject: [PATCH] add state --- src/croc/croc.go | 2 ++ src/croc/sender.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/croc/croc.go b/src/croc/croc.go index 2b9c8a57..144115f7 100644 --- a/src/croc/croc.go +++ b/src/croc/croc.go @@ -50,6 +50,8 @@ type Croc struct { // is using local relay isLocal bool normalFinish bool + + State string } // Init will initiate with the default parameters diff --git a/src/croc/sender.go b/src/croc/sender.go index 75831b96..8cce512e 100644 --- a/src/croc/sender.go +++ b/src/croc/sender.go @@ -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 {