From: Sergey Matveev Date: Fri, 6 Jan 2017 11:52:20 +0000 (+0300) Subject: Log sent size, not the queued one X-Git-Tag: 0.1~40 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f82e8876be5ca77dec74f3e771ad65f745a6b5f1;p=nncp.git Log sent size, not the queued one --- diff --git a/src/cypherpunks.ru/nncp/llp.go b/src/cypherpunks.ru/nncp/llp.go index 6ab8e41..e237c89 100644 --- a/src/cypherpunks.ru/nncp/llp.go +++ b/src/cypherpunks.ru/nncp/llp.go @@ -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:]