Skip to content

AmpCode review fixes#1

Merged
lhoward merged 8 commits into
mainfrom
amp-fixes
Mar 19, 2026
Merged

AmpCode review fixes#1
lhoward merged 8 commits into
mainfrom
amp-fixes

Conversation

@lhoward
Copy link
Copy Markdown
Contributor

@lhoward lhoward commented Mar 19, 2026

No description provided.

@lhoward lhoward self-assigned this Mar 19, 2026
@lhoward lhoward added the bug Something isn't working label Mar 19, 2026
lhoward added 8 commits March 20, 2026 10:07
nl_sock is not thread-safe. The DispatchSource read handler,
nl_send_auto, and nl_socket_use_seq were previously called from
different queues concurrently. Route all nl_sock access through a
single serial DispatchQueue to prevent data races.
…cations

Using AsyncThrowingChannel required spawning an unstructured Task to
call the async send() method from a synchronous callback, which
destroyed kernel event ordering. Switch to AsyncThrowingStream with an
unbounded buffering policy so yield() can be called synchronously,
preserving strict event ordering.
If nl_msg_parse's callback fires zero times, obj remains nil and would
crash when passed to self.init(obj:). If it fires multiple times, the
previous pointer was leaked. Now release the previous object before
overwriting, and throw NLError.invalidArgument if no object was parsed.
nfnl_log_alloc() can return nil on OOM. Passing nil to
NLObject(consumingObj:) which expects a non-optional OpaquePointer
would crash. Guard and throw NLError.noMemory instead.
…uest

If message.send() throws, the stream continuation remained in the
_requests dictionary forever. Remove it on error to prevent the leak.
Returning the negative errno from the error callback caused
nl_recvmsgs to abort, discarding other pending messages in the receive
buffer. Return NL_SKIP to continue processing remaining messages.
Pass the UnsafeRawBufferPointer directly to nlmsg_append instead of
copying into an intermediate Array.
@lhoward lhoward merged commit a03b9be into main Mar 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant