Package freenet.io.xfer

Examples of freenet.io.xfer.BulkReceiver


  static byte[] innerWaitForOpennetNoderef(long xferUID, int paddedLength, int realLength, PeerNode source, boolean isReply, long uid, boolean sendReject, ByteCounter ctr, Node node) {
    byte[] buf = new byte[paddedLength];
    ByteArrayRandomAccessBuffer raf = new ByteArrayRandomAccessBuffer(buf);
    PartiallyReceivedBulk prb = new PartiallyReceivedBulk(node.usm, buf.length, Node.PACKET_SIZE, raf, false);
    BulkReceiver br = new BulkReceiver(prb, source, xferUID, ctr);
    if (logMINOR) {
      Logger.minor(OpennetManager.class, "Receiving noderef (reply="+isReply+") as bulk transfer for request uid "+uid+" with transfer "+xferUID+" from "+source);
    }
    if (!br.receive()) {
      if (source.isConnected()) {
        String msg = "Failed to receive noderef bulk transfer : "
          +RetrievalException.getErrString(prb.getAbortReason())+" : "
          +prb.getAbortDescription()+" from "+source;
        if (prb.getAbortReason() != RetrievalException.SENDER_DISCONNECTED) {
View Full Code Here


    }
    try {
      final byte[] data = new byte[length];
      RandomAccessBuffer raf = new ByteArrayRandomAccessBuffer(data);
      PartiallyReceivedBulk prb = new PartiallyReceivedBulk(node.usm, length, Node.PACKET_SIZE, raf, false);
      final BulkReceiver br = new BulkReceiver(prb, this, uid, node.nodeStats.foafCounter);
      node.executor.execute(new Runnable() {

        @Override
        public void run() {
          try {
            if(br.receive()) {
              ByteArrayInputStream bais = new ByteArrayInputStream(data);
              InflaterInputStream dis = new InflaterInputStream(bais);
              SimpleFieldSet fs;
              try {
                fs = new SimpleFieldSet(new BufferedReader(new InputStreamReader(dis, "UTF-8")), false, false);
View Full Code Here

      } catch (IOException e) {
        // Impossible
        throw new Error("Impossible: FileNotFoundException opening with RAF with rw! "+e, e);
      }
      prb = new PartiallyReceivedBulk(node.usm, size, Node.PACKET_SIZE, data, false);
      receiver = new BulkReceiver(prb, DarknetPeerNode.this, uid, null);
      // FIXME make this persistent
      node.executor.execute(new Runnable() {
        @Override
        public void run() {
          if(logMINOR)
View Full Code Here

    }
   
    PartiallyReceivedBulk prb = new PartiallyReceivedBulk(updateManager.node.getUSM(), length,
      Node.PACKET_SIZE, raf, false);

    final BulkReceiver br = new BulkReceiver(prb, source, uid, updateManager.ctr);

    updateManager.node.executor.execute(new Runnable() {

      @Override
      public void run() {
        try {
        if(br.receive())
          // Success!
          processRevocationBlob(temp, source);
        else {
          Logger.error(this, "Failed to transfer revocation certificate from " + source);
          System.err.println("Failed to transfer revocation certificate from " + source);
View Full Code Here

    }

    PartiallyReceivedBulk prb = new PartiallyReceivedBulk(updateManager.node.getUSM(), length,
      Node.PACKET_SIZE, raf, false);

    final BulkReceiver br = new BulkReceiver(prb, source, uid, updateManager.ctr);

    updateManager.node.executor.execute(new Runnable() {

      @Override
      public void run() {
        boolean success = false;
        try {
          synchronized(UpdateOverMandatoryManager.class) {
            nodesAskedSendMainJar.remove(source);
            nodesSendingMainJar.add(source);
          }
          success = br.receive();
          if(success)
            // Success!
            processMainJarBlob(temp, source, version, jarURI);
          else {
            Logger.error(this, "Failed to transfer main jar " + version + " from " + source);
View Full Code Here

            tmp = FileUtil.createTempFile(saveTo.getName(), NodeUpdateManager.TEMP_FILE_SUFFIX, saveTo.getParentFile());
            raf = new FileRandomAccessBuffer(tmp, size, false);
            PartiallyReceivedBulk prb =
              new PartiallyReceivedBulk(updateManager.node.getUSM(), size,
                Node.PACKET_SIZE, raf, false);
            BulkReceiver br = new BulkReceiver(prb, fetchFrom, uid, updateManager.ctr);
            failed = !br.receive();
            raf.close();
            raf = null;
            if(!failed) {
              // Check the hash.
              if(MainJarDependenciesChecker.validFile(tmp, expectedHash, size, executable)) {
View Full Code Here

TOP

Related Classes of freenet.io.xfer.BulkReceiver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.