void SendCmd_End(IAsyncResult ar) { Quit_SO stateObj = (Quit_SO)ar.AsyncState; try { stateObj.UpdateContext(); //---------------------------------------- //finish sending command _cc.EndSendCommand(ar); //---------------------------------------- //Notify DTP that it should handle quit //issue _client.CurrentDTP.Quit(); } catch (Exception e) { stateObj.Exception = e; } finally { //---------------------------------------- //Unlock control connection _cc.Unlock(); stateObj.SetCompleted(); } }
void SendCmdEx_End(IAsyncResult ar) { Quit_SO stateObj = (Quit_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) { Quit_SO stateObj = (Quit_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 //quit command _cc.BeginSendCommand(stateObj.Timeout, "QUIT", new AsyncCallback(SendCmd_End), stateObj); } else { //---------------------------------------- //In case there is no DTP, we should //dealing with responses here ... _cc.BeginSendCommandEx(stateObj.Timeout, "QUIT", new AsyncCallback(SendCmdEx_End), stateObj); } } catch (Exception e) { stateObj.Exception = e; stateObj.SetCompleted(); } }