diff --git a/codec/MsgPackConstant.cs b/codec/MsgPackConstant.cs index cf60610..61a88d7 100644 --- a/codec/MsgPackConstant.cs +++ b/codec/MsgPackConstant.cs @@ -9,7 +9,7 @@ public sealed class MsgPackConstant public static readonly long MAX_UINT16 = EzyMath.bin2int(16); public static readonly long MAX_UINT32 = EzyMath.bin2long(32); - public static readonly long MIN_NEGATIVE_FIXINT = -EzyMath.bin2int(5); + public static readonly long MIN_NEGATIVE_FIXINT = -EzyMath.bin2int(5) - 1; public static readonly long MIN_INT8 = -EzyMath.bin2int(7); public static readonly long MIN_INT16 = -EzyMath.bin2int(15); public static readonly long MIN_INT32 = -EzyMath.bin2int(31); diff --git a/handler/EzyConnectionFailureHandler.cs b/handler/EzyConnectionFailureHandler.cs index 959679f..08fa2ef 100644 --- a/handler/EzyConnectionFailureHandler.cs +++ b/handler/EzyConnectionFailureHandler.cs @@ -18,10 +18,15 @@ protected override sealed void process(EzyConnectionFailureEvent evt) client.setStatus(EzyConnectionStatus.FAILURE); if (mustReconnect) reconnecting = client.reconnect(); - if (!reconnecting) + if (reconnecting) { - control(evt); + onReconnecting(evt); } + else + { + onConnectionFailed(evt); + } + postHandle(evt); } protected virtual bool shouldReconnect(EzyConnectionFailureEvent evt) @@ -29,7 +34,15 @@ protected virtual bool shouldReconnect(EzyConnectionFailureEvent evt) return true; } - protected virtual void control(EzyConnectionFailureEvent evt) + protected virtual void onReconnecting(EzyConnectionFailureEvent evt) + { + } + + protected virtual void onConnectionFailed(EzyConnectionFailureEvent evt) + { + } + + protected virtual void postHandle(EzyConnectionFailureEvent evt) { } } diff --git a/handler/EzyDisconnectionHandler.cs b/handler/EzyDisconnectionHandler.cs index 7b3547b..3c0aca7 100644 --- a/handler/EzyDisconnectionHandler.cs +++ b/handler/EzyDisconnectionHandler.cs @@ -24,10 +24,14 @@ protected override void process(EzyDisconnectionEvent evt) client.setUdpStatus(EzyConnectionStatus.DISCONNECTED); if (mustReconnect) reconnecting = client.reconnect(); - if (!reconnecting) + if (reconnecting) { - control(evt); + onReconnecting(evt); } + else + { + onDisconnected(evt); + } postHandle(evt); } @@ -35,6 +39,14 @@ protected virtual void preHandle(EzyDisconnectionEvent evt) { } + protected virtual void onReconnecting(EzyDisconnectionEvent evt) + { + } + + protected virtual void onDisconnected(EzyDisconnectionEvent evt) + { + } + protected virtual void postHandle(EzyDisconnectionEvent evt) { } @@ -46,9 +58,5 @@ protected virtual bool shouldReconnect(EzyDisconnectionEvent evt) return false; return true; } - - protected virtual void control(EzyDisconnectionEvent evt) - { - } } }