ttorrent
ttorrent copied to clipboard
IllegalStateException: Trying to download a piece while previous download not completed!
I'm getting the following all over the place when I download a torrent using the master branch right now.
Exception in thread "bt-peer(..BC5A6F)-recv" java.lang.IllegalStateException: Trying to download a piece while previous download not completed!
at com.turn.ttorrent.client.peer.SharingPeer.downloadPiece(SharingPeer.java:357)
at com.turn.ttorrent.client.SharedTorrent.handlePeerReady(SharedTorrent.java:700)
at com.turn.ttorrent.client.peer.SharingPeer.firePeerReady(SharingPeer.java:654)
at com.turn.ttorrent.client.peer.SharingPeer.handleMessage(SharingPeer.java:615)
at com.turn.ttorrent.client.peer.PeerExchange$IncomingThread.run(PeerExchange.java:364)
IllegalStateException is a RuntimeException so it seems like it's being thrown somewhere in the program and not being handled. I can't seem to track down exactly from where & it usually starts flooding the error stream mid way though the download.
Thoughts?
+1
+1
Looks like this is a long standing issue, see #140
+1
+1
+1
+1
+1
+1
took a look at the code and it seems like a rather simple fix and it might actually be an issue where the current implementation might not download a requested piece (need to double check this accusation though).
the method handlePeerReady(SharingPeer peer)
is called in 2 places and one of them already checks if the peer is currently downloading. it makes more sense to add a check for isDownloading
in that handle peer ready method and break out quietly instead of doing anything in that method. my suggestion:
@Override
public synchronized void handlePeerReady(SharingPeer peer) {
if (peer.isDownloading()) return;
// ... the existing body
}
is this library being maintained still?