wikiti / extension-networking

Library developed for OpenFL to facilitate connections between applications, using TCP sockets, and following the scheme of event-driven programming.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught exception - Invalid call from networking.sessions.Session::disconnectClient line 124

DrDynamic opened this issue · comments

I get the following exception when calling the disconnectClient() method on a Server-Session.

Called from networking.sessions.Session::disconnectClient line 127
Uncaught exception - Invalid call

To repoduce, you can instanciate the attayched class and try to connect two clients.
After connecting the second client, the first one should be disconnected but instead the Application crashes.

CommandServer.zip

How ever I was able to fix this issue by Modifieing the disconnectClient() method in Session.hx to this:
(Castes the network_item from Dynamic to Server Class )


public function disconnectClient(cl: ClientObject = null) {
  switch(mode) {
    case SERVER:
      if (network_item == null || cl == null) return;
      var server:Server = network_item;
      server.disconnectClient(cl);

    case CLIENT:
      if (network_item == null) return;
      stop();
  }
}

Hello @DrDynamic ,

Thank you for your note. I'll make some checks, and implement your changes if everything works properly.

Best regards,
Daniel

@DrDynamic I've just released version 1.4.2, correcting this issue.

Since this should be resolved, I'm closing this issue. If you have any more questions, or the issue isn't yet fixed, feel free to re-open this issue, or open a new one.

Best regards,
Daniel