Skip to content

feat: use sendmmsg in linux, and increase parameter values while still remaining conservative#70

Open
richard-ramos wants to merge 1 commit intofix/variousfrom
fix/various-2
Open

feat: use sendmmsg in linux, and increase parameter values while still remaining conservative#70
richard-ramos wants to merge 1 commit intofix/variousfrom
fix/various-2

Conversation

@richard-ramos
Copy link
Member

No description provided.

@richard-ramos richard-ramos requested a review from a team as a code owner March 17, 2026 13:12
@richard-ramos richard-ramos requested review from Copilot, gmelodie and vladopajic and removed request for a team March 17, 2026 13:12
msg_len: cuint

proc sendmmsg(
sockfd: SocketHandle, msgvec: ptr MMsgHdr, vlen: cuint, flags: cint

Choose a reason for hiding this comment

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

[nph] reported by reviewdog 🐶

Suggested change
sockfd: SocketHandle, msgvec: ptr MMsgHdr, vlen: cuint, flags: cint
sockfd: SocketHandle, msgvec: ptr MMsgHdr, vlen: cuint, flags: cint

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes packet sending on Linux by using sendmmsg (batch syscall) instead of per-packet sendmsg, and increases QUIC flow control window settings for both client and server while keeping them conservative.

Changes:

  • Use Linux sendmmsg syscall to batch-send multiple packets in a single system call
  • Increase connection and stream flow control windows for both client and server contexts
  • Remove unused imports (sequninit, net)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lsquic/context/io.nim Add sendmmsg FFI binding for Linux; refactor sendPacketsOut to use batch sending on Linux
lsquic/context/server.nim Increase server flow control window settings
lsquic/context/client.nim Increase client flow control window settings (more aggressively than server)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


let res = sendmmsg(SocketHandle(quicCtx.fd), addr msgs[0], nspecs, 0)
if res < 0:
return 0
Copy link
Member

Choose a reason for hiding this comment

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

because we need to return how much data is written, and when there is error 0 is returned? but what should happen to this error?

@richard-ramos richard-ramos changed the title feat: use sendmmsg in linux, and increase settings while still remaining conservative feat: use sendmmsg in linux, and increase parameter values while still remaining conservative Mar 17, 2026

let res = sendmmsg(SocketHandle(quicCtx.fd), addr msgs[0], nspecs, 0)
if res < 0:
return 0
Copy link
Member

Choose a reason for hiding this comment

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

because we need to return how much data is written, and when there is error 0 is returned? but what should happen to this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants