From b5e7eb3b30a3cf5f7207c26610a7ee866c6f4caa Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 20 Dec 2019 10:58:05 +0300 Subject: [PATCH] Fix not occurring handshake messages padding --- doc/news.ru.texi | 3 +++ doc/news.texi | 3 +++ src/sp.go | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/news.ru.texi b/doc/news.ru.texi index dc74fa1..28c0922 100644 --- a/doc/news.ru.texi +++ b/doc/news.ru.texi @@ -8,6 +8,9 @@ @item Сообщения прогресса содержат префикс, поясняющий выполняемое действие. +@item +Исправлено не происходящее дополнение (padding) handshake сообщений. + @end itemize @node Релиз 5.2.1 diff --git a/doc/news.texi b/doc/news.texi index 894a2ef..9af9ba4 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -10,6 +10,9 @@ See also this page @ref{Новости, on russian}. @item Progress messages contain prefix, describing the running action. +@item +Fixed not occurring handshake messages padding. + @end itemize @node Release 5.2.1 diff --git a/src/sp.go b/src/sp.go index 4a44a2e..06f7eb4 100644 --- a/src/sp.go +++ b/src/sp.go @@ -37,12 +37,13 @@ const ( MaxSPSize = 1<<16 - 256 PartSuffix = ".part" DefaultDeadline = 10 + + SPHeadOverhead = 4 ) var ( MagicNNCPLv1 [8]byte = [8]byte{'N', 'N', 'C', 'P', 'S', 0, 0, 1} - SPHeadOverhead int SPInfoOverhead int SPFreqOverhead int SPFileOverhead int @@ -114,8 +115,8 @@ func init() { if _, err := xdr.Marshal(&buf, spHead); err != nil { panic(err) } + SPHaltMarshalized = make([]byte, SPHeadOverhead) copy(SPHaltMarshalized, buf.Bytes()) - SPHeadOverhead = buf.Len() buf.Reset() spInfo := SPInfo{Nice: 123, Size: 123, Hash: new([32]byte)} -- 2.48.1