Changeset 43c2018 for apps


Ignore:
Timestamp:
Jul 5, 2018 12:57:01 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
25e567a1
Parents:
7d9207d
Message:

i2psnark: Fix IOOBE when stopping torrent that is allocating (ticket #2273)
more sync in PartialPiece?

Location:
apps/i2psnark/java/src/org/klomp/snark
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/PartialPiece.java

    r7d9207d r43c2018  
    113113     */
    114114
    115     public Request getRequest() {
     115    public synchronized Request getRequest() {
    116116        return new Request(this, this.off, Math.min(this.pclen - this.off, PeerState.PARTSIZE));
    117117    }
     
    132132     *  How many bytes are good - as set by setDownloaded() or read()
    133133     */
    134     public int getDownloaded() {
     134    public synchronized int getDownloaded() {
    135135         return this.off;
    136136    }
     
    142142     *  @since 0.9.1
    143143     */
    144     public void setDownloaded(int offset) {
     144    public synchronized void setDownloaded(int offset) {
    145145         this.off = offset;
    146146    }
  • apps/i2psnark/java/src/org/klomp/snark/PeerState.java

    r7d9207d r43c2018  
    547547                  int dl = pp.getDownloaded();
    548548                  if (req.off != dl)
    549                       req = new Request(pp, dl, 1);
     549                      req = new Request(pp, dl);
    550550              }
    551551              rv.add(req);
  • apps/i2psnark/java/src/org/klomp/snark/Request.java

    r7d9207d r43c2018  
    5454
    5555  /**
     56   * Dummy Request for PeerState.returnPartialPieces().
     57   * len will be zero.
     58   *
     59   * @param piece Piece number requested.
     60   * @param off the offset in the array.
     61   * @since 0.9.36
     62   */
     63  Request(PartialPiece piece, int off)
     64  {
     65    this.piece = piece;
     66    this.off = off;
     67    this.len = 0;
     68
     69    // Sanity check
     70    if (off < 0 || off > piece.getLength())
     71      throw new IndexOutOfBoundsException("Illegal Request " + toString());
     72  }
     73
     74  /**
    5675   *  @since 0.9.1
    5776   */
Note: See TracChangeset for help on using the changeset viewer.