Git Product home page Git Product logo

Comments (3)

anacrolix avatar anacrolix commented on May 30, 2024

With v1 BitTorrent, more than 1 file can share a piece. Those files will be created, and the data for overlapping pieces written to them in those cases. Zero-length files are always created by storages, since there's no actual data download that would otherwise trigger their creation.

from torrent.

sweetbbak avatar sweetbbak commented on May 30, 2024

Thank you for the insight. That possibility didn't occur to me.

I tested it out with something like this

	fi := t.Files()[1]
	b := fi.BeginPieceIndex()
	e := fi.EndPieceIndex()
	t.DownloadPieces(b, e)

	for {
		fmt.Printf("pieces [%v - %v]\n", b, e)

		for i := b; i < e; i++ {
			ps := t.PieceState(i)

			if ps.Complete {
				fmt.Print("\x1b[33m|\x1b[0m")
			} else {
				fmt.Print("\x1b[31m|\x1b[0m")
			}
		}

		time.Sleep(time.Millisecond * 99)
		println("\x1b[2J\x1b[H")
	}

and got

pieces [53 - 54]

which ended up being associated with 3 different files, one of which was complete, one incomplete but mostly put together and one that was mostly zeroed out and had a small chunk of data way at the bottom. thats really interesting how that works. I'll have to go and try to figure out how other torrent clients handle this problem. Thanks.

from torrent.

anacrolix avatar anacrolix commented on May 30, 2024

They may stage the data in a different location and copy it out on demand, but I doubt it.

Interestingly in BitTorrent v2 this doesn't occur, but it's hardly a misfeature in the first place.

from torrent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.