You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
964 B
26 lines
964 B
3 years ago
|
using System;
|
||
|
using System.IO;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
[SessionStreamDispatcher(SessionStreamDispatcherType.SessionStreamDispatcherClientOuter)]
|
||
|
public class SessionStreamDispatcherClientOuter: ISessionStreamDispatcher
|
||
|
{
|
||
|
public void Dispatch(Session session, MemoryStream memoryStream)
|
||
|
{
|
||
|
ushort opcode = BitConverter.ToUInt16(memoryStream.GetBuffer(), Packet.KcpOpcodeIndex);
|
||
|
Type type = OpcodeTypeComponent.Instance.GetType(opcode);
|
||
|
object message = MessageSerializeHelper.DeserializeFrom(opcode, type, memoryStream);
|
||
|
|
||
|
if (message is IResponse response)
|
||
|
{
|
||
|
session.OnRead(opcode, response);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
OpcodeHelper.LogMsg(session.DomainZone(), opcode, message);
|
||
|
// 普通消息或者是Rpc请求消息
|
||
|
MessageDispatcherComponent.Instance.Handle(session, opcode, message);
|
||
|
}
|
||
|
}
|
||
|
}
|