public uint SendExceptionResult(string errMessage, string errWhere, uint errCode, ushort requestId, ulong reqIndex) { if (reqIndex == ulong.MaxValue) { return(ServerCoreLoader.SendExceptionResult(m_sh, errMessage, errWhere, requestId, errCode)); } return(ServerCoreLoader.SendExceptionResultIndex(m_sh, reqIndex, errMessage, errWhere, requestId, errCode)); }
public uint SendExceptionResult(string errMessage, string errWhere, uint errCode) { ulong reqIndex = CurrentRequestIndex; if (reqIndex == ulong.MaxValue) { return(ServerCoreLoader.SendExceptionResult(m_sh, errMessage, errWhere, 0, errCode)); } return(ServerCoreLoader.SendExceptionResultIndex(m_sh, reqIndex, errMessage, errWhere, 0, errCode)); }
internal virtual void OnChatComing(tagChatRequestID chatRequestID) { uint svsId = ServerCoreLoader.GetSvsID(m_sh); CUQueue q = m_qBuffer; if (svsId != BaseServiceID.sidHTTP) { bool endian = false; tagOperationSystem os = ServerCoreLoader.GetPeerOs(m_sh, ref endian); q.Endian = endian; q.OS = os; } switch (chatRequestID) { case tagChatRequestID.idEnter: { object objGroups; q.Load(out objGroups); OnSubscribe((uint[])objGroups); } break; case tagChatRequestID.idExit: { OnUnsubscribe(ChatGroups); } break; case tagChatRequestID.idSendUserMessage: { object msg; string user; q.Load(out user).Load(out msg); OnSendUserMessage(user, msg); } break; case tagChatRequestID.idSpeak: { object msg; object groups; q.Load(out groups).Load(out msg); OnPublish(msg, (uint[])groups); } break; default: ServerCoreLoader.SendExceptionResult(m_sh, "Unexpected chat request", Environment.StackTrace, (ushort)chatRequestID, 0); break; } }
private void OnFast(ulong hSocket, ushort usRequestID, uint len) { CSocketPeer sp = Seek(hSocket); if (sp == null) { return; } try { if (sp.SvsID == BaseServiceID.sidHTTP) { ((CHttpPeerBase)sp).OnHttpRequestArrive(usRequestID, (uint)sp.m_qBuffer.GetSize()); } else { CClientPeer cp = (CClientPeer)sp; if (!cp.m_dicDel.ContainsKey(usRequestID)) { if (sp is CClientPeer) { ((CClientPeer)sp).OnFast(usRequestID, len); } else { ServerCoreLoader.SendExceptionResult(hSocket, "Request not registered at server side", Environment.StackTrace, usRequestID, 0); } } else { object[] args = new object[] { cp.m_dicDel[usRequestID] }; object res = m_dicMethod[usRequestID].Invoke(cp, args); res = null; } } } catch (Exception ex) { ServerCoreLoader.SendExceptionResult(hSocket, ex.Message, ex.StackTrace, usRequestID, 0); } }
public uint SendExceptionResult(string errMessage, string errWhere, uint errCode, ushort requestId) { return(ServerCoreLoader.SendExceptionResult(m_sh, errMessage, errWhere, requestId, errCode)); }
public uint SendExceptionResult(string errMessage, string errWhere, uint errCode) { return(ServerCoreLoader.SendExceptionResult(m_sh, errMessage, errWhere, 0, errCode)); }
private int OnSlow(ushort usRequestID, uint len, ulong hSocket) { CSocketPeer sp = Seek(hSocket); if (sp == null) { return(0); } try { if (sp.SvsID == BaseServiceID.sidHTTP) { return(((CHttpPeerBase)sp).OnHttpRequestArrive(usRequestID, (uint)sp.m_qBuffer.GetSize())); } else { CClientPeer cp = (CClientPeer)sp; if (!cp.m_dicDel.ContainsKey(usRequestID)) { if (sp is CClientPeer) { return(((CClientPeer)sp).OnSlow(usRequestID, len)); } ServerCoreLoader.SendExceptionResult(hSocket, "Request not registered at server side", Environment.StackTrace, usRequestID, uint.MaxValue); return(0); } else { object[] args = new object[] { cp.m_dicDel[usRequestID] }; object res = m_dicMethod[usRequestID].Invoke(cp, args); res = null; } } } catch (TargetInvocationException tie) { if (tie.InnerException == null) { ServerCoreLoader.SendExceptionResult(hSocket, tie.Message, tie.StackTrace, usRequestID, uint.MaxValue); } else if (tie.InnerException is CServerError) { CServerError ex = (CServerError)tie.InnerException; ushort req_id = ex.ReqId; if (req_id == 0) { req_id = usRequestID; } int index = ex.StackTrace.IndexOf("at SocketProAdapter.ServerSide.CClientPeer"); string stack = ex.StackTrace.Substring(0, index).Trim(); ServerCoreLoader.SendExceptionResult(hSocket, ex.Message, stack, req_id, (uint)ex.ErrCode); } else { Exception ex = tie.InnerException; ServerCoreLoader.SendExceptionResult(hSocket, ex.Message, ex.StackTrace, usRequestID, uint.MaxValue); } } catch (CServerError ex) { ushort req_id = ex.ReqId; if (req_id == 0) { req_id = usRequestID; } int index = ex.StackTrace.IndexOf("at SocketProAdapter.ServerSide.CClientPeer"); string stack = ex.StackTrace.Substring(0, index).Trim(); ServerCoreLoader.SendExceptionResult(hSocket, ex.Message, stack, req_id, (uint)ex.ErrCode); } catch (Exception ex) { ServerCoreLoader.SendExceptionResult(hSocket, ex.Message, ex.StackTrace, usRequestID, uint.MaxValue); } return(0); }