public override int GetConnection(string sServer, out IGConnection retConnection, bool bConnectingAllowed) { retConnection = null; foreach (IGConnection connection in m_lConnections) { if (connection.m_sUser == sServer) { retConnection = connection; return IGSMAnswer.IGSMANSWER_ERROR_NONE; } } return (int)IGSMAnswer.IGSMANSWER_ERROR_CODE.IGSMANSWER_ERROR_SERVERNOTFOUND; }
public override int GetConnection(string sUser, out IGConnection retConnection, bool bConnectingAllowed) { retConnection = null; foreach (IGConnectionLocal connection in m_lConnections) { if (connection.m_sUser == sUser) { if (!bConnectingAllowed) { if (connection.IsUserConnecting()) return (int)IGSMAnswer.IGSMANSWER_ERROR_CODE.IGSMANSWER_ERROR_USERCONNECTING; if (connection.IsUserDisconnecting()) { retConnection = connection; return (int)IGSMAnswer.IGSMANSWER_ERROR_CODE.IGSMANSWER_ERROR_USERDISCONNECTING; } } retConnection = connection; return IGSMAnswer.IGSMANSWER_ERROR_NONE; } } return (int)IGSMAnswer.IGSMANSWER_ERROR_CODE.IGSMANSWER_ERROR_USERNOTFOUND; }
protected override IGAnswer createAnswer(int nAnswerId, XmlDocument xmlDoc, XmlNode xmlNodeAnswer, IGConnection userConnection) { if (IGSMAnswer.IsSMAnswer(nAnswerId)) { switch (nAnswerId) { case IGSMAnswer.IGSMANSWER_PONG: return new IGSMAnswerPing(xmlDoc); case IGSMAnswer.IGSMANSWER_GETSTATUS: return new IGSMStatus(xmlDoc); case IGSMAnswer.IGSMANSWER_TERMINATED: return new IGSMAnswerTerminate(xmlDoc); case IGSMAnswer.IGSMANSWER_INITIALIZED: return new IGSMAnswerInitialized(xmlDoc); case IGSMAnswer.IGSMANSWER_ERROR: return new IGSMAnswerError(xmlDoc); case IGSMAnswer.IGSMANSWER_ACTIONDONE: return new IGSMAnswerActionDone(xmlDoc); case IGSMAnswer.IGSMANSWER_UPLOADED: return new IGSMAnswerUploadSucceeded(xmlDoc); case IGSMAnswer.IGSMANSWER_DELETED: return new IGSMAnswerDeleted(xmlDoc); } } else { return base.createAnswer(nAnswerId, xmlDoc, xmlNodeAnswer, userConnection); } return new IGAnswerUnknown(xmlDoc); }
public virtual bool Reset() { m_connection = null; m_bDisconnected = false; return true; }
public virtual void Terminate() { m_bDisconnected = true; m_connection = null; }
public virtual void ResetConnection(IGConnection connection) { m_connection = connection; }
public override void ResetConnection(IGConnection connection) { m_bReseting = true; IGRequestProcessing.Cleanup(m_connection); m_connection = connection; Terminate(); }
public static void Cleanup(IGConnection connection) { lock (s_lProcessingRequests.SyncRoot) { List<IGRequestProcessing> reqToRemove = new List<IGRequestProcessing>(); foreach (IGRequestProcessing reqProc in s_lProcessingRequests) { if (reqProc.m_request.Connection == connection) { reqProc.m_request.FireEventDone(new IGSMAnswer((int)IGSMAnswer.IGSMANSWER_ERROR_CODE.IGSMANSWER_ERROR_REQUESTPROCESSING, "Following request crashed in IGServer: " + reqProc.m_request.ToString()).GetXml()); reqToRemove.Add(reqProc); } } foreach (var req in reqToRemove) Remove(req); } }