]> Cypherpunks.ru repositories - nncp.git/commitdiff
Log sent size, not the queued one
authorSergey Matveev <stargrave@stargrave.org>
Fri, 6 Jan 2017 11:52:20 +0000 (14:52 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 6 Jan 2017 11:52:20 +0000 (14:52 +0300)
src/cypherpunks.ru/nncp/llp.go

index 6ab8e41834aa449479f0fb78f51dc87fc55ce8ef..e237c8926854c92f5e8a4b24cfcf9d8d10908df5 100644 (file)
@@ -557,12 +557,13 @@ func (state *LLPState) StartWorkers(conn net.Conn, infosPayloads [][]byte, paylo
                                        Offset:  freq.Offset,
                                        Payload: buf,
                                })
-                               state.ctx.LogP("llp-file", SdsAdd(sdsp, SDS{
-                                       "fullsize": strconv.FormatInt(int64(fullSize), 10),
-                               }), "")
+                               ourSize := freq.Offset + uint64(len(buf))
+                               sdsp["size"] = strconv.FormatInt(int64(ourSize), 10)
+                               sdsp["fullsize"] = strconv.FormatInt(int64(fullSize), 10)
+                               state.ctx.LogP("llp-file", sdsp, "")
                                state.Lock()
                                if len(state.queueTheir) > 0 && *state.queueTheir[0].Hash == *freq.Hash {
-                                       if freq.Offset+uint64(len(buf)) == fullSize {
+                                       if ourSize == fullSize {
                                                state.ctx.LogD("llp-file", sdsp, "finished")
                                                if len(state.queueTheir) > 1 {
                                                        state.queueTheir = state.queueTheir[1:]