Skip to content

Commit

Permalink
Merge pull request #438 from x0wllaar/fix-netconn-alignment
Browse files Browse the repository at this point in the history
Fix unaligned load error on 32-bit architectures

Closes #432
  • Loading branch information
nhooyr committed Mar 7, 2024
2 parents 819f9d1 + 1cc90bb commit 8d2374e
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions netconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,25 @@ func NetConn(ctx context.Context, c *Conn, msgType MessageType) net.Conn {
}

type netConn struct {
// These must be first to be aligned on 32 bit platforms.
// https://github.com/nhooyr/websocket/pull/438
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
reader io.Reader
writeTimer *time.Timer
writeMu *mu
writeCtx context.Context
writeCancel context.CancelFunc

readTimer *time.Timer
readMu *mu
readCtx context.Context
readCancel context.CancelFunc
readEOFed bool
reader io.Reader
}

var _ net.Conn = &netConn{}
Expand Down

0 comments on commit 8d2374e

Please sign in to comment.