fixed: custom property wrong size
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
using Ragon.Protocol;
|
||||
|
||||
namespace Ragon.Server.Entity;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RagonPayload
|
||||
|
||||
public void Read(RagonBuffer buffer)
|
||||
{
|
||||
_size = buffer.Capacity;
|
||||
_size = buffer.Capacity - 1;
|
||||
buffer.ReadArray(_data, _size);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,13 @@ public class RagonProperty : RagonPayload
|
||||
|
||||
public void Write(RagonBuffer buffer)
|
||||
{
|
||||
if (IsFixed)
|
||||
{
|
||||
buffer.WriteArray(_data, Size);
|
||||
return;
|
||||
}
|
||||
|
||||
buffer.Write((ushort) Size);
|
||||
buffer.WriteArray(_data, Size);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,11 @@ public class RagonServer : IRagonServer, INetworkListener
|
||||
_timer.Start();
|
||||
while (true)
|
||||
{
|
||||
if (_timer.ElapsedMilliseconds > _tickRate * 2)
|
||||
{
|
||||
_logger.Warn($"Slow perfomance: {_timer.ElapsedMilliseconds}");
|
||||
}
|
||||
|
||||
if (_timer.ElapsedMilliseconds > _tickRate)
|
||||
{
|
||||
_timer.Restart();
|
||||
@@ -197,7 +202,7 @@ public class RagonServer : IRagonServer, INetworkListener
|
||||
_reader.FromArray(data);
|
||||
|
||||
var operation = _reader.ReadByte();
|
||||
_handlers[operation].Handle(context, channel);
|
||||
_handlers[operation]?.Handle(context, channel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user