]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/sp.go
Raise copyright years
[nncp.git] / src / sp.go
index ce2e62f5d86be3492fc7a4192bca978c9c62b760..4a44a2e6bad82c4ea3d6042724cbf8b931ff85ff 100644 (file)
--- a/src/sp.go
+++ b/src/sp.go
@@ -1,6 +1,6 @@
 /*
 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2020 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -634,7 +634,7 @@ func (state *SPState) StartWorkers(
                                sdsp["size"] = int64(ourSize)
                                sdsp["fullsize"] = fullSize
                                if state.Ctx.ShowPrgrs {
-                                       Progress(sdsp)
+                                       Progress("Tx", sdsp)
                                }
                                state.Lock()
                                if len(state.queueTheir) > 0 && *state.queueTheir[0].freq.Hash == *freq.Hash {
@@ -680,6 +680,9 @@ func (state *SPState) StartWorkers(
                        conn.SetReadDeadline(time.Now().Add(DefaultDeadline * time.Second))
                        payload, err := state.ReadSP(conn)
                        if err != nil {
+                               if err == io.EOF {
+                                       break
+                               }
                                unmarshalErr := err.(*xdr.UnmarshalError)
                                netErr, ok := unmarshalErr.Err.(net.Error)
                                if ok && netErr.Timeout() {
@@ -875,7 +878,7 @@ func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
                        sdsp["size"] = int64(ourSize)
                        sdsp["fullsize"] = int64(state.infosTheir[*file.Hash].Size)
                        if state.Ctx.ShowPrgrs {
-                               Progress(sdsp)
+                               Progress("Rx", sdsp)
                        }
                        if state.infosTheir[*file.Hash].Size != ourSize {
                                state.RUnlock()