diff --git a/src/comm/comm.go b/src/comm/comm.go index c2ef6376..44c0c6e9 100644 --- a/src/comm/comm.go +++ b/src/comm/comm.go @@ -18,7 +18,7 @@ type Comm struct { func New(c net.Conn) Comm { c.SetReadDeadline(time.Now().Add(3 * time.Hour)) c.SetDeadline(time.Now().Add(3 * time.Hour)) - c.SetWriteDeadline(time.Now().Add(20 * time.Second)) + c.SetWriteDeadline(time.Now().Add(3 * time.Hour)) return Comm{c} } diff --git a/src/croc/sending.go b/src/croc/sending.go index 1da231d1..846b4982 100644 --- a/src/croc/sending.go +++ b/src/croc/sending.go @@ -45,13 +45,14 @@ func (c *Croc) Send(fname, codephrase string) (err error) { // broadcast for peer discovery go func() { - log.Debug("starting local croc relay...") - go peerdiscovery.Discover(peerdiscovery.Settings{ + log.Debug("starting local discovery...") + discovered, err := peerdiscovery.Discover(peerdiscovery.Settings{ Limit: 1, TimeLimit: 600 * time.Second, Delay: 50 * time.Millisecond, Payload: []byte(c.RelayWebsocketPort + "- " + strings.Join(c.RelayTCPPorts, ",")), }) + log.Debug(discovered, err) }() // connect to own relay @@ -76,6 +77,7 @@ func (c *Croc) Receive(codephrase string) (err error) { // use local relay first if !c.NoLocal { + log.Debug("trying discovering") // try to discovery codephrase and server through peer network discovered, errDiscover := peerdiscovery.Discover(peerdiscovery.Settings{ Limit: 1, @@ -85,6 +87,8 @@ func (c *Croc) Receive(codephrase string) (err error) { AllowSelf: true, DisableBroadcast: true, }) + log.Debug("finished") + log.Debug(discovered) if errDiscover != nil { log.Debug(errDiscover) } diff --git a/src/recipient/recipient.go b/src/recipient/recipient.go index 141eb4dd..ac83d658 100644 --- a/src/recipient/recipient.go +++ b/src/recipient/recipient.go @@ -318,11 +318,11 @@ func receive(forceSend int, serverAddress string, tcpPorts []string, isLocal boo } n, err = f.WriteAt(decrypted, int64(locationToWrite)) fProgress.WriteString(fmt.Sprintf("%d\n", locationToWrite)) - log.Debugf("writing to location %d (%2.0f/%2.0f)", locationToWrite, blocksWritten, blocksToWrite) + log.Debugf("wrote %d bytes to location %d (%2.0f/%2.0f)", n, locationToWrite, blocksWritten, blocksToWrite) } else { // write to file n, err = f.Write(decrypted) - log.Debugf("writing to location %d (%2.0f/%2.0f)", bytesWritten, blocksWritten, blocksToWrite) + log.Debugf("wrote %d bytes to location %d (%2.0f/%2.0f)", n, bytesWritten, blocksWritten, blocksToWrite) fProgress.WriteString(fmt.Sprintf("%d\n", bytesWritten)) } if err != nil { @@ -336,7 +336,7 @@ func receive(forceSend int, serverAddress string, tcpPorts []string, isLocal boo // update the progress bar bar.Add(n) if int64(bytesWritten) == fstats.Size || blocksWritten >= blocksToWrite { - log.Debug("finished") + log.Debug("finished", int64(bytesWritten), fstats.Size, blocksWritten, blocksToWrite) break } }