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

[BUG]when client send msg to server concurrently. how the server guarantee the response of ask(ctx, msg, mustWaitOnlyTheNextMessage) is matchs the send? #113

Open
DOLLook opened this issue Jun 27, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@DOLLook
Copy link

DOLLook commented Jun 27, 2024

The ask in conn.go line 941. when server send msg to the client. it start a goroutine and runs c.Socket().ReadData(c.readTimeout) to read the next msg. But how it guarantee the next msg is the response that the ask method send?
On the other hand, when websocket connected, the server runs startReader() that runs c.Socket().ReadData(c.readTimeout) in loop. In multi goroutine that may be run at the same time. Is it safe to read and how to guarantee the ask() method's response is matchs the ask()?

@DOLLook DOLLook added the bug Something isn't working label Jun 27, 2024
@DOLLook
Copy link
Author

DOLLook commented Jun 27, 2024

May be there is no need to use the param mustWaitOnlyTheNextMessage in ask() method. then the ask() method will always use the main loop to read response for the ask() and send the response by channel. finally the ask() can received the response synchronized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants