Skip to content

Commit cdb8f32

Browse files
committed
update socket reader
1 parent 69d66dc commit cdb8f32

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

socket/EzySocketReader.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,18 @@ namespace com.tvd12.ezyfoxserver.client.socket
1313
{
1414
public abstract class EzySocketReader : EzySocketAdapter
1515
{
16-
protected EzyQueue<EzyArray> dataQueue;
1716
protected EzySocketDataDecoder decoder;
1817
protected readonly int readBufferSize;
18+
protected readonly EzyQueue<EzyArray> dataQueue;
1919
protected readonly EzyCallback<EzyMessage> decodeBytesCallback;
2020

2121
public EzySocketReader()
2222
{
23+
this.dataQueue = new EzySynchronizedQueue<EzyArray>();
2324
this.readBufferSize = EzySocketConstants.MAX_READ_BUFFER_SIZE;
2425
this.decodeBytesCallback = message => onMesssageReceived(message);
2526
}
2627

27-
protected override void run()
28-
{
29-
this.dataQueue = new EzySynchronizedQueue<EzyArray>();
30-
base.run();
31-
}
32-
3328
protected override void update()
3429
{
3530
byte[] readBytes = new byte[readBufferSize];

socket/EzyUdpSocketReader.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,17 @@ namespace com.tvd12.ezyfoxserver.client.socket
1212
{
1313
public class EzyUdpSocketReader : EzySocketAdapter
1414
{
15-
protected readonly int readBufferSize;
16-
protected EzyQueue<EzyArray> dataQueue;
1715
protected EzySocketDataDecoder decoder;
1816
protected UdpClient datagramChannel;
1917
protected IPEndPoint serverEndPoint;
18+
protected readonly int readBufferSize;
19+
protected readonly EzyQueue<EzyArray> dataQueue;
2020

2121
public EzyUdpSocketReader() : base()
22-
{
23-
this.readBufferSize = EzySocketConstants.MAX_READ_BUFFER_SIZE;
24-
}
25-
26-
protected override void run()
2722
{
2823
this.dataQueue = new EzySynchronizedQueue<EzyArray>();
2924
this.serverEndPoint = new IPEndPoint(IPAddress.Any, 0);
30-
base.run();
25+
this.readBufferSize = EzySocketConstants.MAX_READ_BUFFER_SIZE;
3126
}
3227

3328
protected override void update()

0 commit comments

Comments
 (0)