Skip to content

Commit

Permalink
Fix nasa#969, socket accept using incorrect record
Browse files Browse the repository at this point in the history
The OS_SocketAccept call was using the incorrect token, using
the server/acceptor socket when it should have used the connection
socket.

The bug overwrote data in the acceptor socket, but it would only cause
an issue when the user attempted to use the server socket to accept
a second connection, but the tests only performed a single connection.

This also improves the network-api-test to do multiple connections,
re-using the same acceptor socket between them.
  • Loading branch information
jphickey committed Apr 27, 2021
1 parent afb5f7b commit 479c021
Show file tree
Hide file tree
Showing 2 changed files with 202 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/os/shared/src/osapi-sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ int32 OS_SocketAccept(osal_id_t sock_id, osal_id_t *connsock_id, OS_SockAddr_t *
if (return_code == OS_SUCCESS)
{
conn_record = OS_OBJECT_TABLE_GET(OS_global_stream_table, conn_token);
conn = OS_OBJECT_TABLE_GET(OS_stream_table, sock_token);
conn = OS_OBJECT_TABLE_GET(OS_stream_table, conn_token);

/* Incr the refcount to record the fact that an operation is pending on this */
memset(conn, 0, sizeof(OS_stream_internal_record_t));
Expand Down
Loading

0 comments on commit 479c021

Please sign in to comment.