mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2024-04-21 12:21:34 +00:00
Fix(atomic panic): 64-bit fields must be 64-bit aligned on 32-bit systems (#358)
This commit is contained in:
@@ -17,12 +17,18 @@ import (
|
||||
const Name = "MEMORY"
|
||||
|
||||
type User struct {
|
||||
sent uint64
|
||||
recv uint64
|
||||
lastSent uint64
|
||||
lastRecv uint64
|
||||
sendSpeed uint64
|
||||
recvSpeed uint64
|
||||
// WARNING: do not change the order of these fields.
|
||||
// 64-bit fields that use `sync/atomic` package functions
|
||||
// must be 64-bit aligned on 32-bit systems.
|
||||
// Reference: https://github.com/golang/go/issues/599
|
||||
// Solution: https://github.com/golang/go/issues/11891#issuecomment-433623786
|
||||
sent uint64
|
||||
recv uint64
|
||||
lastSent uint64
|
||||
lastRecv uint64
|
||||
sendSpeed uint64
|
||||
recvSpeed uint64
|
||||
|
||||
hash string
|
||||
ipTable sync.Map
|
||||
ipNum int32
|
||||
|
||||
@@ -29,9 +29,15 @@ const (
|
||||
)
|
||||
|
||||
type OutboundConn struct {
|
||||
// WARNING: do not change the order of these fields.
|
||||
// 64-bit fields that use `sync/atomic` package functions
|
||||
// must be 64-bit aligned on 32-bit systems.
|
||||
// Reference: https://github.com/golang/go/issues/599
|
||||
// Solution: https://github.com/golang/go/issues/11891#issuecomment-433623786
|
||||
sent uint64
|
||||
recv uint64
|
||||
|
||||
metadata *tunnel.Metadata
|
||||
sent uint64
|
||||
recv uint64
|
||||
user statistic.User
|
||||
headerWrittenOnce sync.Once
|
||||
net.Conn
|
||||
|
||||
@@ -21,9 +21,15 @@ import (
|
||||
|
||||
// InboundConn is a trojan inbound connection
|
||||
type InboundConn struct {
|
||||
// WARNING: do not change the order of these fields.
|
||||
// 64-bit fields that use `sync/atomic` package functions
|
||||
// must be 64-bit aligned on 32-bit systems.
|
||||
// Reference: https://github.com/golang/go/issues/599
|
||||
// Solution: https://github.com/golang/go/issues/11891#issuecomment-433623786
|
||||
sent uint64
|
||||
recv uint64
|
||||
|
||||
net.Conn
|
||||
sent uint64
|
||||
recv uint64
|
||||
auth statistic.Authenticator
|
||||
user statistic.User
|
||||
hash string
|
||||
|
||||
Reference in New Issue
Block a user