-
Notifications
You must be signed in to change notification settings - Fork 426
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
Examples for the AsyncTCP #165
Open
martinmmi
wants to merge
6
commits into
me-no-dev:master
Choose a base branch
from
OttoWinter:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Commits on Oct 14, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 5b1ef41 - Browse repository at this point
Copy the full SHA 5b1ef41View commit details -
Configuration menu - View commit details
-
Copy full SHA for c18b7ca - Browse repository at this point
Copy the full SHA c18b7caView commit details
Commits on Apr 8, 2021
-
Configuration menu - View commit details
-
Copy full SHA for d2fec0c - Browse repository at this point
Copy the full SHA d2fec0cView commit details -
Configuration menu - View commit details
-
Copy full SHA for cfecaa3 - Browse repository at this point
Copy the full SHA cfecaa3View commit details
Commits on Apr 11, 2021
-
Fix race condition causing 'ack timeout 4' disconnects (#4)
The AsyncClient::send() methods sets a boolean to true after pushing data over the TCP socket successfully using tcp_output(). It also sets a timestamp to remember at what time the data was sent. The AsyncClient::_sent() callback method reacts to ACKs coming from the connected client. This method sets the boolean to false. In the AsyncClient::_poll() method, a check is done to see if the boolean is true ("I'm waiting for an ACK") and if the time at which the data was sent is too long ago (5000 ms). If this is the case, a connection issue with the connected client is assumed and the connection is forcibly closed by the server. The race condition is when these operations get mixed up, because of multithreading behavior. The _sent() method can be called during the execution of the send() method: 1. send() sends out data using tcp_output() 2. _sent() is called because an ACK is processed, sets boolean to false 3. send() continues and sets boolean to true + timestamp to "now" After this, the data exchange with the client was successful. Data were sent and the ACK was seen. However, the boolean ended up as true, making the _poll() method think that an ACK is still to be expected. As a result, 5000 ms later, the connection is dropped. This commit fixes the code by first registering that an ACK is expected, before calling tcp_output(). This way, there is no race condition when the ACK is processed right after that call. Additionally, I changed the boolean to an integer counter value. The server might send multiple messages to the client, resulting in multiple expected ACKs. A boolean does not cover this situation. Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
Configuration menu - View commit details
-
Copy full SHA for 030b747 - Browse repository at this point
Copy the full SHA 030b747View commit details -
Configuration menu - View commit details
-
Copy full SHA for f278522 - Browse repository at this point
Copy the full SHA f278522View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.