Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/connect request id null #86

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Runtime/EcsactRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ IntPtr callbackUserData

public delegate void AsyncReqCompleteCallback(
Int32 requestIdsLength,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] Int32[] requestIds,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Int32[] requestIds,
IntPtr callbackUserData
);

Expand Down Expand Up @@ -858,13 +858,13 @@ private static void OnAsyncErrorHandler(
Int32[] requestIds,
IntPtr callbackUserData
) {
UnityEngine.Debug.Log("AsyncError!" + requestIds[0]);
var self = (GCHandle.FromIntPtr(callbackUserData).Target as Async)!;

if(self.connectRequestId.HasValue) {
var connectReqId = self.connectRequestId.Value;
for(int i = 0; requestIdsLength > i; ++i) {
if(connectReqId == requestIds[i]) {
self.connectRequestId = null;
self.connectState = ConnectState.ConnectError;
try {
self.connectStateChange?.Invoke(self.connectState);
Expand Down Expand Up @@ -904,13 +904,13 @@ public static void OnAsyncReqCompleteHandler(
Int32[] requestIds,
IntPtr callbackUserData
) {
UnityEngine.Debug.Log("Request completed: " + requestIds);
var self = (GCHandle.FromIntPtr(callbackUserData).Target as Async)!;

if(self.connectRequestId.HasValue) {
var connectReqId = self.connectRequestId.Value;
for(int i = 0; requestIdsLength > i; ++i) {
if(connectReqId == requestIds[i]) {
self.connectRequestId = null;
self.connectState = ConnectState.Connected;
self.connectStateChange?.Invoke(self.connectState);
break;
Expand Down