good morning!!!!

Skip to content
Snippets Groups Projects
Commit 4c273310 authored by Grigorii Khvatskii's avatar Grigorii Khvatskii Committed by Grigorii Khvatskii
Browse files

Fix unaligned load error on 32-bit architectures

On some 32-bit architectures, 64-bit atomic operations panic when the
value is not aligned properly.

In this package, this causes netConn operations to panic when compiling
with GOARCH=386, since netConn does atomic operations with int64 values
in the netConn struct (namely, with readExpired and writeExpired).

This commit fixes this by moving readExpired and writeExpired to the
beginning of the struct, which makes them properly aligned.
parent e3a2d32f
Branches
Tags
Loading
......@@ -94,18 +94,19 @@ func NetConn(ctx context.Context, c *Conn, msgType MessageType) net.Conn {
}
type netConn struct {
readExpired int64
writeExpired int64
c *Conn
msgType MessageType
writeTimer *time.Timer
writeMu *mu
writeExpired int64
writeCtx context.Context
writeCancel context.CancelFunc
readTimer *time.Timer
readMu *mu
readExpired int64
readCtx context.Context
readCancel context.CancelFunc
readEOFed bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment