"syscall"
"time"
+ "bitbucket.org/anacrolix/go.torrent/util/levelmu"
+
"bitbucket.org/anacrolix/go.torrent/dht"
. "bitbucket.org/anacrolix/go.torrent/util"
downloadStrategy DownloadStrategy
dHT *dht.Server
- mu sync.Mutex
+ mu levelmu.LevelMutex
event sync.Cond
quit chan struct{}
// Read torrent data at the given offset. Returns ErrDataNotReady if the data
// isn't available.
func (cl *Client) TorrentReadAt(ih InfoHash, off int64, p []byte) (n int, err error) {
- cl.mu.Lock()
+ cl.mu.LevelLock(1)
defer cl.mu.Unlock()
t := cl.torrent(ih)
if t == nil {
torrents: make(map[InfoHash]*torrent),
}
cl.event.L = &cl.mu
+ cl.mu.Init(2)
o := copy(cl.peerID[:], BEP20)
_, err = rand.Read(cl.peerID[o:])