12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using CommonNetwork_ICE.Util;
- using System.Collections;
- using Slice;
- using CommonServer_ICE.Session;
- using CommonLang.Protocol;
- namespace CommonServer_ICE.Msg
- {
-
-
-
- internal class SeverSendMsgManager
- {
-
- private static SeverSendMsgQueue[] queueList;
-
- private static bool runFlag = false;
-
-
-
- public static void StartSendMsgQueue()
- {
- queueList = new SeverSendMsgQueue[Env.SEND_MSG_ACK_CHECK_THREAD_CNT];
- for (int i = 0; i < Env.SEND_MSG_ACK_CHECK_THREAD_CNT; i++)
- {
- Hashtable map = new Hashtable();
- queueList[i] = new SeverSendMsgQueue(map);
- queueList[i].Start();
- }
- runFlag = true;
- }
-
-
-
- public static void EndSendMsgQueue()
- {
- runFlag = false;
- for (int i = 0; i < Env.SEND_MSG_ACK_CHECK_THREAD_CNT; i++)
- {
- queueList[i].End();
- }
- }
-
-
-
-
-
-
- public static void AddPacket(IceServerIoSession session, IMessage imessage, TransMessage transMessage)
- {
- if (!runFlag)
- {
- return;
- }
- MsgSessionPacket packet = new MsgSessionPacket();
- packet.Session = session;
- packet.ID = packet.Session.ID.ToString();
- packet.Message = transMessage;
- packet.SrcMessage = imessage;
- int id = int.Parse(packet.Session.ID);
- int index = id % Env.SEND_MSG_ACK_CHECK_THREAD_CNT;
- queueList[index].AddPacket(packet);
- }
- }
- }
|