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

Consolidate switch logic in OS_SocketOpen_Impl #859

Closed
skliper opened this issue Mar 10, 2021 · 0 comments · Fixed by #893 or #917
Closed

Consolidate switch logic in OS_SocketOpen_Impl #859

skliper opened this issue Mar 10, 2021 · 0 comments · Fixed by #893 or #917
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Mar 10, 2021

Is your feature request related to a problem? Please describe.
Duplicate switch cases that could be consolidated:

switch (stream->socket_type)
{
case OS_SocketType_DATAGRAM:
os_type = SOCK_DGRAM;
break;
case OS_SocketType_STREAM:
os_type = SOCK_STREAM;
break;
default:
return OS_ERR_NOT_IMPLEMENTED;
}

/* Only AF_INET* at this point, can add cases if support is expanded */
switch (stream->socket_type)
{
case OS_SocketType_DATAGRAM:
os_proto = IPPROTO_UDP;
break;
case OS_SocketType_STREAM:
os_proto = IPPROTO_TCP;
break;
}

Describe the solution you'd like
Consolidate

Describe alternatives you've considered
Was separate if future domains were added... but is currently awkward looking.

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC, OSAL code review

@skliper skliper added this to the 6.0.0 milestone Mar 10, 2021
@skliper skliper self-assigned this Mar 11, 2021
astrogeco added a commit that referenced this issue Mar 17, 2021
Fix #859, Consolidate duplicated switch in OS_SocketOpen_Impl
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant