From 1d2934f480f71d41eab85e7de9e97b3dafaaf81a Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 6 Feb 2016 14:04:00 +0300 Subject: [PATCH] Align statistics counters for correct sync.atomic work on 32-bit systems Signed-off-by: Sergey Matveev --- VERSION | 2 +- doc/news.ru.texi | 8 ++++++++ doc/news.texi | 8 ++++++++ src/cypherpunks.ru/govpn/peer.go | 25 +++++++++++++------------ 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/VERSION b/VERSION index 37c2d99..9ad974f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.4 +5.5 diff --git a/doc/news.ru.texi b/doc/news.ru.texi index 980cace..23aac4e 100644 --- a/doc/news.ru.texi +++ b/doc/news.ru.texi @@ -2,6 +2,7 @@ @section Новости @menu +* Релиз 5.5:: * Релиз 5.4:: * Релиз 5.3:: * Релиз 5.2:: @@ -28,6 +29,13 @@ * Релиз 1.0:: @end menu +@node Релиз 5.5 +@subsection Релиз 5.5 +@itemize +@item Возможность работы на 32-х битных платформах. @emph{sync/atomic} +библиотека имеет особенности из-за которых предыдущие версии паниковали. +@end itemize + @node Релиз 5.4 @subsection Релиз 5.4 @itemize diff --git a/doc/news.texi b/doc/news.texi index c96fdb9..4aaa695 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -4,6 +4,7 @@ See also this page @ref{Новости, on russian}. @menu +* Release 5.5:: * Release 5.4:: * Release 5.3:: * Release 5.2:: @@ -30,6 +31,13 @@ See also this page @ref{Новости, on russian}. * Release 1.0:: @end menu +@node Release 5.5 +@section Release 5.5 +@itemize +@item Ability to work on 32-bit platforms. @emph{sync/atomic} library +has some specific issues that caused panics on previous versions. +@end itemize + @node Release 5.4 @section Release 5.4 @itemize diff --git a/src/cypherpunks.ru/govpn/peer.go b/src/cypherpunks.ru/govpn/peer.go index 4b48cec..a9c0aaa 100644 --- a/src/cypherpunks.ru/govpn/peer.go +++ b/src/cypherpunks.ru/govpn/peer.go @@ -64,6 +64,19 @@ func newNonceCipher(key *[32]byte) *xtea.Cipher { } type Peer struct { + // Statistics (they are at the beginning for correct int64 alignment) + BytesIn uint64 + BytesOut uint64 + BytesPayloadIn uint64 + BytesPayloadOut uint64 + FramesIn uint64 + FramesOut uint64 + FramesUnauth uint64 + FramesDup uint64 + HeartbeatRecv uint64 + HeartbeatSent uint64 + + // Basic Addr string Id *PeerId Conn io.Writer @@ -95,18 +108,6 @@ type Peer struct { LastSent time.Time willSentCycle time.Time - // Statistics - BytesIn uint64 - BytesOut uint64 - BytesPayloadIn uint64 - BytesPayloadOut uint64 - FramesIn uint64 - FramesOut uint64 - FramesUnauth uint64 - FramesDup uint64 - HeartbeatRecv uint64 - HeartbeatSent uint64 - // Receiver BusyR sync.Mutex `json:"-"` bufR []byte -- 2.44.0