Skip to content

Commit 911675b

Browse files
tvd12vu-luong
andauthored
Merge master (#49): add event loop group
* add virtual to ping schedule methods (#45) * add event loop group (#42) * add event loop group * usage * update * update * update * set eventLoopGroup for udp client * remove empy line * remove empy line * correct to use delayTime * reduce log level * remove unnecessary logs * fix EzyWSPingSchedule constructor (#50) --------- Co-authored-by: Vu Luong <vubinhcht@gmail.com>
1 parent 545f3d3 commit 911675b

23 files changed

+981
-49
lines changed

EzyTcpClient.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using com.tvd12.ezyfoxserver.client.socket;
1111
using static com.tvd12.ezyfoxserver.client.constant.EzyConnectionStatuses;
1212
using com.tvd12.ezyfoxserver.client.statistics;
13+
using com.tvd12.ezyfoxserver.client.concurrent;
1314

1415
namespace com.tvd12.ezyfoxserver.client
1516
{
@@ -40,15 +41,24 @@ public class EzyTcpClient :
4041
protected readonly EzySocketClient socketClient;
4142
protected readonly EzyPingSchedule pingSchedule;
4243
protected readonly EzyLogger logger;
44+
protected readonly EzyEventLoopGroup eventLoopGroup;
4345

44-
public EzyTcpClient(EzyClientConfig config)
46+
public EzyTcpClient(EzyClientConfig config) : this(config, null)
47+
{
48+
}
49+
50+
public EzyTcpClient(
51+
EzyClientConfig config,
52+
EzyEventLoopGroup eventLoopGroup
53+
)
4554
{
4655
this.config = config;
4756
this.name = config.getClientName();
4857
this.status = EzyConnectionStatus.NULL;
4958
this.status = EzyConnectionStatus.NULL;
59+
this.eventLoopGroup = eventLoopGroup;
5060
this.pingManager = new EzySimplePingManager(config.getPing());
51-
this.pingSchedule = new EzyPingSchedule(this);
61+
this.pingSchedule = new EzyPingSchedule(this, eventLoopGroup);
5262
this.handlerManager = new EzySimpleHandlerManager(this);
5363
this.networkStatistics = new EzySimpleStatistics();
5464
this.requestSerializer = new EzySimpleRequestSerializer();
@@ -73,6 +83,7 @@ protected EzySocketClient newSocketClient()
7383
client.setPingManager(pingManager);
7484
client.setNetworkStatistics(networkStatistics);
7585
client.setHandlerManager(handlerManager);
86+
client.setEventLoopGroup(eventLoopGroup);
7687
client.setReconnectConfig(config.getReconnect());
7788
client.setUnloggableCommands(unloggableCommands);
7889
return client;

EzyUTClient.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using com.tvd12.ezyfoxserver.client.config;
55
using com.tvd12.ezyfoxserver.client.socket;
66
using com.tvd12.ezyfoxserver.client.request;
7+
using com.tvd12.ezyfoxserver.client.concurrent;
78

89
namespace com.tvd12.ezyfoxserver.client
910
{
@@ -13,6 +14,13 @@ public EzyUTClient(EzyClientConfig config) : base(config)
1314
{
1415
}
1516

17+
public EzyUTClient(
18+
EzyClientConfig config,
19+
EzyEventLoopGroup eventLoopGroup
20+
) : base(config, eventLoopGroup)
21+
{
22+
}
23+
1624
protected override EzyTcpSocketClient newTcpSocketClient()
1725
{
1826
return new EzyUTSocketClient();

concurrent/EzyEventLoopEvent.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace com.tvd12.ezyfoxserver.client.concurrent
2+
{
3+
public interface EzyEventLoopEvent
4+
{
5+
bool call();
6+
7+
void onFinished() { }
8+
9+
void onRemoved() { }
10+
}
11+
}

0 commit comments

Comments
 (0)