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

ipc: Retry receiving credentials if the the message is short #476

Merged
merged 2 commits into from
Nov 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/ipc_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ int qb_ipcc_setup_connect_continue(struct qb_ipcc_connection *c, struct qb_ipc_c
{
struct ipc_auth_data *data;
int32_t res;
int retry_count = 0;
#ifdef QB_LINUX
int off = 0;
#endif
Expand All @@ -486,8 +487,12 @@ int qb_ipcc_setup_connect_continue(struct qb_ipcc_connection *c, struct qb_ipc_c
qb_ipcc_us_sock_close(c->setup.u.us.sock);
return -ENOMEM;
}

retry:
res = qb_ipc_us_recv_msghdr(data);
if (res == -EAGAIN && ++retry_count < 10) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's minor detail, but could we change magic constant (10) to constant? Same probably with usleep time (100000)?

usleep(100000);
kgaillot marked this conversation as resolved.
Show resolved Hide resolved
goto retry;
}

#ifdef QB_LINUX
setsockopt(c->setup.u.us.sock, SOL_SOCKET, SO_PASSCRED, &off,
Expand Down