From c1cabe75dc232daa95ba9564af59d9c5bbae1585 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 7 Jul 2020 09:08:15 -0700 Subject: [PATCH] derp: fix server struct fielfd alignment on 32-bit Mostly so the GitHub CI will pass on 32-bit. --- derp/derp_server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/derp/derp_server.go b/derp/derp_server.go index ff1cb3e12..36002ddca 100644 --- a/derp/derp_server.go +++ b/derp/derp_server.go @@ -38,6 +38,9 @@ writeTimeout = 2 * time.Second ) +const host64bit = (^uint(0) >> 32) & 1 // 1 on 64-bit, 0 on 32-bit +const pad32bit = 4 - host64bit*4 // 0 on 64-bit, 4 on 32-bit + // Server is a DERP server. type Server struct { // WriteTimeout, if non-zero, specifies how long to wait @@ -51,6 +54,7 @@ type Server struct { meshKey string // Counters: + _ [pad32bit]byte packetsSent, bytesSent expvar.Int packetsRecv, bytesRecv expvar.Int packetsDropped expvar.Int @@ -61,6 +65,7 @@ type Server struct { packetsDroppedQueueHead *expvar.Int // queue full, drop head packet packetsDroppedQueueTail *expvar.Int // queue full, drop tail packet packetsDroppedWrite *expvar.Int // error writing to dst conn + _ [pad32bit]byte packetsForwardedOut expvar.Int packetsForwardedIn expvar.Int peerGoneFrames expvar.Int // number of peer gone frames sent