-
Notifications
You must be signed in to change notification settings - Fork 105
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
Solution to issues #114, #118, #184. #237
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spin_unlock(&conn->splock); | ||
if (sk) { | ||
ss_send(sk, &msg->skb_list); | ||
sock_put(sk); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ss_sock_put()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks bit unusual bedause double sk checking on most probable workflow, I'd rewrite it like
sk = conn->sk;
if (unlikely(!sk)) {
spin_unlock(&conn->splock);
return;
}
ss_sock_hold(sk);
spin_unlock(&conn->splock);
ss_send(sk, &msg->skb_list);
ss_sock_put(sk);
For servers TfwConnection{}.sk was set at the time a connect was attempted, not when a connection was established. Now TfwConnection{}.sk is set only for an established connection.
Use the usual TfwConnection{} everywhere but for a few specific cases.
- Lock is taken only for very short durations where necessary; - Actions on connection establishing and destruction are carefully ordered; - It should be assumed that data from schedulers is not 100% accurate; - Don't send data on a dead connection;
52a393a
to
0119b15
Compare
Socket hold/put operations are now tied with Tempesta's logic. Take a hold of a socket with when connection is established, and Tempesta is linked with Sync Sockets layer. Release the socket with connection is closed, and Tempesta is unlinked from Sync Socket layer.
Also, comment differences in lifetime expectations.
That is completely unnecessary, as the next step is always release of the instance of connection structure.
conn->refcnt reference counter may get down to zero in case of multiple concurrent calls to tfw_connection_put(). However, the counter was only initialized at the time TfwSrvConnection{} instance was created, and not initialized when a new connection was established. In case of server connection
…114) Server connection instances are persistent in a sense that once created, the instance is reused for new connections to the server. When a connection fails it may happen that the connection still has users, and therefore can not be reused just yet. The solution was to start a wait for an arbirtrary time period, and then try again. The problem with the solution is that the wait period is, well, arbitrary. Now a new connect attempt is started exactly when there're no more users of the connection, which is when the connection is released.
Conflicts: tempesta_fw/connection.c tempesta_fw/connection.h tempesta_fw/http.c tempesta_fw/sched/tfw_sched_hash.c tempesta_fw/sched/tfw_sched_rr.c tempesta_fw/sock.c tempesta_fw/sock_srv.c
Conflicts: tempesta_fw/sock_clnt.c
This was referenced Sep 16, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.