Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Closing client from server closes other clients as well? #101

Open
undsoft opened this issue Sep 15, 2017 · 8 comments
Open

Closing client from server closes other clients as well? #101

undsoft opened this issue Sep 15, 2017 · 8 comments

Comments

@undsoft
Copy link

undsoft commented Sep 15, 2017

Hello, my dear friends.

I need to say that it has been challenging trying to incorporate the library into a production environment :)

Scenario:

  1. User A connects.
  2. User B connects.
  3. After some time when User B sends a message, and in onMessage handler, server decides to disconnect user A.
  4. Server does:
$connection = $node->getConnection();

        $connection->close(
            Connection::CLOSE_NORMAL,
            $message
        );

where $node is the stored node of user A.

ER: User A is disconnected.
AR: Both users seem to lose the connection.

Upon debugging I can see that $node->getConnection()->close() goes to
Hoa\Stream\Stream->close() and to
Hoa\Socket\Server->_close(), which in turn gets current stream (User B, Mistake!) and fcloses it.

@undsoft
Copy link
Author

undsoft commented Sep 15, 2017

Doing

/** @var Rfc6455 $protocol */
        $protocol = $node->getProtocolImplementation();

        $protocol->close(
            Connection::CLOSE_NORMAL,
            $message
        );

doesn't help, it still writes disconnect message to the current node, when I'm trying to remove the other node.

@fclose($node->getSocket());

This seems to be working, but probably bad code.

@Hywan Hywan self-assigned this Sep 25, 2017
@Hywan
Copy link
Member

Hywan commented Sep 25, 2017

Hello & sorry for the late reply, most of the team is AFK.

Are you able to provide me a code to reproduce your issue? Network issues are really hard to debug and to reproduce. I would bet that this usecase is already handled and something else is happening, and I would love to know what :-).

Thanks!

@Hywan
Copy link
Member

Hywan commented Sep 25, 2017

cc @Pierozi

@undsoft
Copy link
Author

undsoft commented Sep 25, 2017

@Hywan
Copy link
Member

Hywan commented Sep 26, 2017

OK, I have a clue. Hard to explain, especially because I am sick and I am not sure. Will try to work on this issue the next couple of days. If you don't have any news from me, feel free to ping me :-).

@undsoft
Copy link
Author

undsoft commented Oct 11, 2017

Bump

@Pierozi
Copy link
Member

Pierozi commented Oct 22, 2017

I think is directly retaled to the way we manage the Nodes, This PR could fix the issue but not sure
hoaproject/Socket#50

@marmotz
Copy link

marmotz commented Mar 23, 2018

Any news ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants