Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Oct 12, 2024
1 parent 917d9f1 commit 0fca426
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/croc/croc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1496,28 +1496,34 @@ func (c *Client) processMessage(payload []byte) (done bool, err error) {

switch m.Type {
case message.TypeFinished:
log.Tracef("message.TypeFinished")
err = message.Send(c.conn[0], c.Key, message.Message{
Type: message.TypeFinished,
})
done = true
c.SuccessfulTransfer = true
return
case message.TypePAKE:
log.Tracef("message.TypePAKE")
err = c.processMessagePake(m)
if err != nil {
err = fmt.Errorf("pake not successful: %w", err)
log.Debug(err)
}
case message.TypeExternalIP:
log.Tracef("message.TypeExternalIP")
done, err = c.processExternalIP(m)
case message.TypeError:
log.Tracef("message.TypeError")
// c.spinner.Stop()
fmt.Print("\r")
err = fmt.Errorf("peer error: %s", m.Message)
return true, err
case message.TypeFileInfo:
log.Tracef("message.TypeFileInfo")
done, err = c.processMessageFileInfo(m)
case message.TypeRecipientReady:
log.Tracef("message.TypeRecipientReady")
var remoteFile RemoteFileRequest
err = json.Unmarshal(m.Bytes, &remoteFile)
if err != nil {
Expand Down Expand Up @@ -1548,6 +1554,7 @@ func (c *Client) processMessage(payload []byte) (done bool, err error) {
}
}
case message.TypeCloseSender:
log.Tracef("message.TypeCloseSender")
c.bar.Finish()
log.Debug("close-sender received...")
c.Step4FileTransferred = false
Expand All @@ -1557,6 +1564,7 @@ func (c *Client) processMessage(payload []byte) (done bool, err error) {
Type: message.TypeCloseRecipient,
})
case message.TypeCloseRecipient:
log.Tracef("message.TypeCloseRecipient")
c.Step4FileTransferred = false
c.Step3RecipientRequestFile = false
}
Expand Down

0 comments on commit 0fca426

Please sign in to comment.