6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) + game logic (GameFix/GameDAL/ServerData) + network layer (NetWorkMessage) + data layer (ObjectModel) + utilities (MrWu/Core/Config/CloudAPI/dll) + adapters (zyxAdapter/base) .NET 8.0 C# solution, 16 projects, 958 source files
35 lines
832 B
C#
35 lines
832 B
C#
using System;
|
|
using System.Net;
|
|
|
|
namespace Server.Net
|
|
{
|
|
public abstract class BaseSession : IDisposable
|
|
{
|
|
public long Id { get; set; }
|
|
|
|
public TService Service { get; set; }
|
|
|
|
public long LastRecvTime { get; set; }
|
|
|
|
public long LastSendTime { get; set; }
|
|
|
|
public int Error { get; set; }
|
|
|
|
public IPEndPoint RemoteAddress { get; set; }
|
|
|
|
protected readonly Action<long> Disposed;
|
|
|
|
public BaseSession(long id, TService service, Action<long> disposedAction)
|
|
{
|
|
this.Id = id;
|
|
this.Service = service;
|
|
this.Disposed = disposedAction;
|
|
}
|
|
|
|
public virtual void Dispose()
|
|
{
|
|
this.Service.Remove(Id);
|
|
Disposed?.Invoke(Id);
|
|
}
|
|
}
|
|
} |