Skip to content

Commit 40786b0

Browse files
authored
feat: connectStateChange invoke on ConnectionClosed error (#95)
additionaly some missing enums in the async error were added
1 parent 15ca1ad commit 40786b0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Runtime/EcsactRuntime.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ public enum ConnectState : Int32 {
2727
}
2828

2929
public enum AsyncError : Int32 {
30+
Ok,
3031
PermissionDenied,
3132
InvalidConnectionString,
3233
ConnectionClosed,
3334
ExecutionMergeFailure,
35+
NotConnected,
3436
}
3537

3638
public enum ecsact_exec_systems_error {
@@ -868,7 +870,10 @@ private static void OnAsyncErrorHandler(
868870
IntPtr callbackUserData
869871
) {
870872
var self = (GCHandle.FromIntPtr(callbackUserData).Target as Async)!;
871-
873+
if(err == Ecsact.AsyncError.ConnectionClosed) {
874+
self.connectState = Ecsact.Async.ConnectState.NotConnected;
875+
self.connectStateChange?.Invoke(self.connectState);
876+
}
872877
if(self.connectRequestId.HasValue) {
873878
var connectReqId = self.connectRequestId.Value;
874879
for(int i = 0; requestIdsLength > i; ++i) {

0 commit comments

Comments
 (0)