Skip to content

Commit

Permalink
mk printer
Browse files Browse the repository at this point in the history
  • Loading branch information
mh0lt committed Jun 30, 2024
1 parent 646bba5 commit 74106fc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ func (me *Peer) cancel(r RequestIndex, updateRequests bool, lock bool, lockTorre
}

if !me.deleteRequest(r, false, false) {
panic("request not existing should have been guarded")
panic(fmt.Sprintf("request %d not existing: should have been guarded", r))
}
if me._cancel(r, false, false) {
// Record that we expect to get a cancel ack.
Expand Down
1 change: 1 addition & 0 deletions storage/mmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (sp mmapStoragePiece) Completion() Completion {
}

func (sp mmapStoragePiece) MarkComplete() error {
fmt.Println("MK", sp.ih, sp.p.Index())
sp.pc.Set(sp.pieceKey(), true)
return nil
}
Expand Down
6 changes: 4 additions & 2 deletions torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ func (t *Torrent) offsetRequest(off int64) (req Request, ok bool) {

func (t *Torrent) writeChunk(piece int, begin int64, data []byte, lock bool) (err error) {
//defer perf.ScopeTimerErr(&err)()
fmt.Println("WRT", t.infoHash, piece, begin, uint32(begin/int64(len(data))))
fmt.Println("WRT", t.infoHash, piece)
n, err := t.piece(piece, lock).Storage().WriteAt(data, begin)
if err == nil && n != len(data) {
err = io.ErrShortWrite
Expand Down Expand Up @@ -2705,7 +2705,7 @@ func (t *Torrent) pieceHashed(piece pieceIndex, passed bool, hashIoErr error) {
t.clearPieceTouchers(piece, true)

if p.hasDirtyChunks(true) {
p.Flush() // You can be synchronous here!
p.Flush()
}

err := p.Storage().MarkComplete()
Expand Down Expand Up @@ -2965,7 +2965,9 @@ func (t *Torrent) processHashResults() {
}

t.pieceHashed(result.index, result.correct, result.copyErr)
fmt.Println("UPP", result.index)
t.updatePiecePriority(result.index, "Torrent.pieceHasher", true)
fmt.Println("UPP", result.index, "DONE")
return nil
})
}(result)
Expand Down

0 comments on commit 74106fc

Please sign in to comment.