Пример #1
0
 protected void startup() throws Exception {
   // send initial reply only if nothing has yet been sent
   synchronized (localControlChannel) {
     if (localControlChannel.getReplyCount() == 0) {
       // 125 Data connection already open; transfer starting
       localControlChannel.write(new LocalReply(125));
     }
   }
 }
Пример #2
0
  public void run() {
    boolean error = false;
    Object quitToken = null;
    logger.debug("TransferSinkThread executing");

    try {
      startup();

      try {
        copy();
      } catch (Exception e) {
        error = true;
        FTPServerFacade.exceptionToControlChannel(
            e, "exception during TransferSinkThread", localControlChannel);
      } finally {
        // attempt to obtain permission to close resources
        quitToken = context.getQuitToken();
        shutdown(quitToken);
      }

      if (!error) {
        // local control channel is shared by all data channels
        // so only the last one exiting may send "226 transfer complete"
        if (quitToken != null) {
          localControlChannel.write(new LocalReply(226));
        }
      }

    } catch (Exception e) {
      // exception occurred when trying to write to local
      // control channel. So there is no way to inform
      // the user.
      FTPServerFacade.cannotPropagateError(e);
    }
  }