mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 23:28:39 +03:00
ensure 64 bit alignment for 64 bit struct fields access atomically
This commit is contained in:
@@ -20,6 +20,9 @@ import (
|
|||||||
|
|
||||||
// BaseConnection defines common fields for a connection using any supported protocol
|
// BaseConnection defines common fields for a connection using any supported protocol
|
||||||
type BaseConnection struct {
|
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
|
||||||
// Unique identifier for the connection
|
// Unique identifier for the connection
|
||||||
ID string
|
ID string
|
||||||
// user associated with this connection if any
|
// user associated with this connection if any
|
||||||
@@ -29,8 +32,6 @@ type BaseConnection struct {
|
|||||||
protocol string
|
protocol string
|
||||||
Fs vfs.Fs
|
Fs vfs.Fs
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
// last activity for this connection
|
|
||||||
lastActivity int64
|
|
||||||
transferID uint64
|
transferID uint64
|
||||||
activeTransfers []ActiveTransfer
|
activeTransfers []ActiveTransfer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,20 +21,20 @@ var (
|
|||||||
// BaseTransfer contains protocols common transfer details for an upload or a download.
|
// BaseTransfer contains protocols common transfer details for an upload or a download.
|
||||||
type BaseTransfer struct { //nolint:maligned
|
type BaseTransfer struct { //nolint:maligned
|
||||||
ID uint64
|
ID uint64
|
||||||
|
BytesSent int64
|
||||||
|
BytesReceived int64
|
||||||
Fs vfs.Fs
|
Fs vfs.Fs
|
||||||
File vfs.File
|
File vfs.File
|
||||||
Connection *BaseConnection
|
Connection *BaseConnection
|
||||||
cancelFn func()
|
cancelFn func()
|
||||||
fsPath string
|
fsPath string
|
||||||
|
requestPath string
|
||||||
start time.Time
|
start time.Time
|
||||||
transferType int
|
MaxWriteSize int64
|
||||||
MinWriteOffset int64
|
MinWriteOffset int64
|
||||||
InitialSize int64
|
InitialSize int64
|
||||||
isNewFile bool
|
isNewFile bool
|
||||||
requestPath string
|
transferType int
|
||||||
BytesSent int64
|
|
||||||
BytesReceived int64
|
|
||||||
MaxWriteSize int64
|
|
||||||
AbortTransfer int32
|
AbortTransfer int32
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
ErrTransfer error
|
ErrTransfer error
|
||||||
|
|||||||
Reference in New Issue
Block a user