Example #1
0
        private void SocketError(int source, int session, string method, byte[] param)
        {
            NetSprotoType.SocketError error = new NetSprotoType.SocketError(param);

            long connectionId = 0;
            bool canFind      = m_node2conn.TryGetValue(error.remoteEndPoint, out connectionId);

            // if connection already exist, that means queue of waitForRequest is empty, because
            // it will send and clear after connect success
            if (canFind)
            {
                Debug.Assert(connectionId == error.connection);

                Dictionary <int, WaitForResponseRequest> waitForResponseRequests = null;
                bool isExist = m_conn2sessions.TryGetValue(error.connection, out waitForResponseRequests);
                if (isExist)
                {
                    Queue <int> tempRemoteSessions = new Queue <int>();
                    foreach (var pair in waitForResponseRequests)
                    {
                        tempRemoteSessions.Enqueue(pair.Key);
                    }

                    int count = tempRemoteSessions.Count;
                    for (int i = 0; i < count; i++)
                    {
                        int remoteSession = tempRemoteSessions.Dequeue();
                        ProcessRemoteResponse(remoteSession, null, RPCError.SocketDisconnected);
                    }
                    m_conn2sessions.Remove(error.connection);
                    m_node2conn.Remove(error.remoteEndPoint);
                }
            }
            else
            {
                string ipEndpoint = error.remoteEndPoint;
                Queue <WaitForSendRequest> waitQueue = null;
                bool isExist = m_waitForSendRequests.TryGetValue(ipEndpoint, out waitQueue);
                if (isExist)
                {
                    int count = waitQueue.Count;
                    for (int i = 0; i < count; i++)
                    {
                        WaitForSendRequest req = waitQueue.Dequeue();
                        DoError(req.Source, req.Session, RPCError.SocketDisconnected, string.Format("RemoteCall {0} failure", req.Method));
                    }

                    m_waitForSendRequests.Remove(ipEndpoint);
                }
            }
        }
Example #2
0
 private void SocketError(int source, int session, string method, byte[] param)
 {
     NetSprotoType.SocketError error = new NetSprotoType.SocketError(param);
     LoggerHelper.Info(m_serviceAddress,
         string.Format("ClusterServer socket error connection:{0} errorCode:{1} errorText:{2}", error.connection, error.errorCode, error.errorText));
 }