void SendCmd_End(IAsyncResult ar) { Abort_SO stateObj = (Abort_SO)ar.AsyncState; try { stateObj.UpdateContext(); //---------------------------------------- //finish sending command _cc.EndSendCommand(ar); //---------------------------------------- //Notify DTP that it should abort data //connection and handle abort command // _client.CurrentDTP.Abort(); } catch (Exception e) { stateObj.Exception = e; } finally { //---------------------------------------- //Unlock control connection _cc.Unlock(); stateObj.SetCompleted(); } }
void SendCmdEx_End(IAsyncResult ar) { Abort_SO stateObj = (Abort_SO)ar.AsyncState; try { stateObj.UpdateContext(); //---------------------------------------- //finish sending command FtpResponse response = _cc.EndSendCommandEx(ar); //---------------------------------------- //Check response FtpClient.CheckCompletionResponse(response); } catch (Exception e) { stateObj.Exception = e; } finally { //---------------------------------------- //Unlock control connection _cc.Unlock(); stateObj.SetCompleted(); } }
void Lock_End(object state, bool timedout) { Abort_SO stateObj = (Abort_SO)state; try { stateObj.UpdateContext(); //---------------------------------------- //Indicate that we lock CC stateObj.CCLocked = true; if (null != _client.CurrentDTP) { //---------------------------------------- //In case when we have active DTP we delegate //handling responses to it and here only send //abort command _cc.BeginSendCommand(stateObj.Timeout, "ABOR", new AsyncCallback(SendCmd_End), stateObj); } else { //---------------------------------------- //In case there is no DTP, but user wants //issue abort command we should dealing with //responses here ... _cc.BeginSendCommandEx(stateObj.Timeout, "ABOR", new AsyncCallback(SendCmdEx_End), stateObj); } } catch (Exception e) { stateObj.Exception = e; stateObj.SetCompleted(); } }