Skip to content

Commit

Permalink
update socket reader
Browse files Browse the repository at this point in the history
  • Loading branch information
tvd12 committed May 9, 2022
1 parent 69d66dc commit cdb8f32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
9 changes: 2 additions & 7 deletions socket/EzySocketReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,18 @@ namespace com.tvd12.ezyfoxserver.client.socket
{
public abstract class EzySocketReader : EzySocketAdapter
{
protected EzyQueue<EzyArray> dataQueue;
protected EzySocketDataDecoder decoder;
protected readonly int readBufferSize;
protected readonly EzyQueue<EzyArray> dataQueue;
protected readonly EzyCallback<EzyMessage> decodeBytesCallback;

public EzySocketReader()
{
this.dataQueue = new EzySynchronizedQueue<EzyArray>();
this.readBufferSize = EzySocketConstants.MAX_READ_BUFFER_SIZE;
this.decodeBytesCallback = message => onMesssageReceived(message);
}

protected override void run()
{
this.dataQueue = new EzySynchronizedQueue<EzyArray>();
base.run();
}

protected override void update()
{
byte[] readBytes = new byte[readBufferSize];
Expand Down
11 changes: 3 additions & 8 deletions socket/EzyUdpSocketReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,17 @@ namespace com.tvd12.ezyfoxserver.client.socket
{
public class EzyUdpSocketReader : EzySocketAdapter
{
protected readonly int readBufferSize;
protected EzyQueue<EzyArray> dataQueue;
protected EzySocketDataDecoder decoder;
protected UdpClient datagramChannel;
protected IPEndPoint serverEndPoint;
protected readonly int readBufferSize;
protected readonly EzyQueue<EzyArray> dataQueue;

public EzyUdpSocketReader() : base()
{
this.readBufferSize = EzySocketConstants.MAX_READ_BUFFER_SIZE;
}

protected override void run()
{
this.dataQueue = new EzySynchronizedQueue<EzyArray>();
this.serverEndPoint = new IPEndPoint(IPAddress.Any, 0);
base.run();
this.readBufferSize = EzySocketConstants.MAX_READ_BUFFER_SIZE;
}

protected override void update()
Expand Down

0 comments on commit cdb8f32

Please sign in to comment.