浏览代码

BaseConnection struct: ensure 64 bit alignment

Fixes #516
Nicola Murino 3 年之前
父节点
当前提交
bd9506da42
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      common/connection.go

+ 2 - 1
common/connection.go

@@ -25,6 +25,8 @@ type BaseConnection struct {
 	// last activity for this connection.
 	// Since this is accessed atomically we put as first element of the struct achieve 64 bit alignment
 	lastActivity int64
+	// transferID is accessed atomically so we put it at the beginning of the struct to achieve 64 bit alignment
+	transferID uint64
 	// Unique identifier for the connection
 	ID string
 	// user associated with this connection if any
@@ -35,7 +37,6 @@ type BaseConnection struct {
 	remoteAddr string
 	localAddr  string
 	sync.RWMutex
-	transferID      uint64
 	activeTransfers []ActiveTransfer
 }