]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add doc comments related to #383
authorMatt Joiner <anacrolix@gmail.com>
Mon, 16 Mar 2020 05:30:39 +0000 (16:30 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 16 Mar 2020 05:30:39 +0000 (16:30 +1100)
conn_stats.go
torrent.go
torrent_stats.go

index 9b0865a08051ea4a1bf61739df806642d8d4810d..3fbc00d867bbaaae1e4618fc1e94a9093506d7f0 100644 (file)
@@ -10,11 +10,11 @@ import (
        pp "github.com/anacrolix/torrent/peer_protocol"
 )
 
-// Various connection-level metrics. At the Torrent level these are
-// aggregates. Chunks are messages with data payloads. Data is actual torrent
-// content without any overhead. Useful is something we needed locally.
-// Unwanted is something we didn't ask for (but may still be useful). Written
-// is things sent to the peer, and Read is stuff received from them.
+// Various connection-level metrics. At the Torrent level these are aggregates. Chunks are messages
+// with data payloads. Data is actual torrent content without any overhead. Useful is something we
+// needed locally. Unwanted is something we didn't ask for (but may still be useful). Written is
+// things sent to the peer, and Read is stuff received from them. Due to the implementation of
+// Count, must be aligned on some platforms: See https://github.com/anacrolix/torrent/issues/262.
 type ConnStats struct {
        // Total bytes on the wire. Includes handshakes and encryption.
        BytesWritten     Count
index 42f5636e8acb071c22809bb0079c5a92f391f00d..bcd80637258df5f42220064291fb4d2958150583 100644 (file)
@@ -1395,6 +1395,8 @@ func (t *Torrent) addPeers(peers []Peer) {
        }
 }
 
+// The returned TorrentStats may require alignment in memory. See
+// https://github.com/anacrolix/torrent/issues/383.
 func (t *Torrent) Stats() TorrentStats {
        t.cl.rLock()
        defer t.cl.rUnlock()
index edc4ac8ee7281310470249727e195afb9298be69..bc54e1bd2768e22ce24e0851036bf5075f630396 100644 (file)
@@ -1,8 +1,10 @@
 package torrent
 
+// Due to ConnStats, may require special alignment on some platforms. See
+// https://github.com/anacrolix/torrent/issues/383.
 type TorrentStats struct {
-       // Aggregates stats over all connections past and present. Some values may
-       // not have much meaning in the aggregate context.
+       // Aggregates stats over all connections past and present. Some values may not have much meaning
+       // in the aggregate context.
        ConnStats
 
        // Ordered by expected descending quantities (if all is well).