-
Notifications
You must be signed in to change notification settings - Fork 69
Apple Network Framework Socket Changes #662
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
Conversation
|
The main changes since last code review:
|
source/posix/socket.c
Outdated
| socket->io_handle.data.fd); | ||
| } | ||
|
|
||
| struct on_start_accept_result_args { |
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.
Unsure if it's worth de-duping this across posix/windows.
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.
Moved it to the private header, I'm not sure if that's better either though 🤔
| struct nw_socket_scheduled_task_args *task_args = arg; | ||
| struct nw_socket *nw_socket = task_args->nw_socket; | ||
|
|
||
| AWS_LOGF_TRACE(AWS_LS_IO_SOCKET, "id=%p: start to process connection result task.", (void *)nw_socket); |
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.
Connection/listener state changes would be better as debug I think
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.
Updated the state_change log to debug. For this specific line, since the function is invoking the connection result callback, I think trace would be a good to track for this callback.
source/darwin/nw_socket.c
Outdated
| if (nw_socket->on_accept_started_fn) { | ||
| nw_socket->on_accept_started_fn(aws_socket, crt_error_code, nw_socket->listen_accept_started_user_data); | ||
| } | ||
| s_unlock_base_socket(nw_socket); |
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.
Is there any chance that something in the accept started callback could invoke something that tries to lock the socket base?
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.
The base socket is only modified(write) at two places:
(1) socket creation/init : The lock is just inited, and would not hold at this time.
(2) aws_socket_cleanup(): This is where the base socket get nulled out. We only lock the base socket if the function is not on the event loop to avoid dead lock. Use this callback as an example, if we call aws_socket_cleanup() in on_accept_started_fn, as it is on the event loop, we will not lock the base socket here.
| aws_socket_set_cleanup_complete_callback( | ||
| socket, s_socket_shutdown_complete_setup_connection_args_fn, close_args); | ||
|
|
||
| SETUP_SOCKET_SHUTDOWN_CALLBACKS( |
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.
Not sure I feel like the macro provides any readability improvement.
Apple Network Framework socket integration
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.