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

debugging

This commit is contained in:
Zack Scholl 2019-04-11 09:45:11 -07:00
parent a0c99e7251
commit 63b3e49dfa
3 changed files with 4 additions and 0 deletions

View file

@ -405,6 +405,7 @@ func (c *Client) processMessage(m Message) (err error) {
pathToFile := path.Join(c.FilesToTransfer[c.FilesToTransferCurrentNum].FolderSource, c.FilesToTransfer[c.FilesToTransferCurrentNum].Name) pathToFile := path.Join(c.FilesToTransfer[c.FilesToTransferCurrentNum].FolderSource, c.FilesToTransfer[c.FilesToTransferCurrentNum].Name)
c.sendSess.TransferFile(pathToFile) c.sendSess.TransferFile(pathToFile)
case "close-sender": case "close-sender":
log.Debug("close-sender received...")
c.Step4FileTransfer = false c.Step4FileTransfer = false
c.Step3RecipientRequestFile = false c.Step3RecipientRequestFile = false
c.sendSess.StopSending() c.sendSess.StopSending()

View file

@ -166,6 +166,7 @@ func (s *Session) receiveData(pathToFile string, fileSize int64) error {
case <-s.sess.Done: case <-s.sess.Done:
s.sess.NetworkStats.Stop() s.sess.NetworkStats.Stop()
log.Debugf("Network: %s", s.sess.NetworkStats.String()) log.Debugf("Network: %s", s.sess.NetworkStats.String())
log.Debug("closed gracefully")
return nil return nil
case msg := <-s.msgChannel: case msg := <-s.msgChannel:
buff, errDecrypt := crypt.DecryptFromBytes(msg.Data, []byte{1, 2, 3, 4}) buff, errDecrypt := crypt.DecryptFromBytes(msg.Data, []byte{1, 2, 3, 4})
@ -177,6 +178,7 @@ func (s *Session) receiveData(pathToFile string, fileSize int64) error {
pos := int64(binary.LittleEndian.Uint64(buff[:8])) pos := int64(binary.LittleEndian.Uint64(buff[:8]))
n, err := f.WriteAt(buff[8:], pos) n, err := f.WriteAt(buff[8:], pos)
if err != nil { if err != nil {
log.Error(err)
return err return err
} else { } else {
if firstByte { if firstByte {

View file

@ -271,6 +271,7 @@ func (s *Session) writeToNetwork() {
} }
func (s *Session) StopSending() { func (s *Session) StopSending() {
log.Debug("StopSending() triggered")
s.stopSending <- struct{}{} s.stopSending <- struct{}{}
} }