Skip to content

vsock: implement DialContext - #78

Merged
SuperQ merged 1 commit into
mdlayher:mainfrom
Sokolmish:main
Oct 15, 2026
Merged

SuperQ merged 1 commit into
mdlayher:mainfrom
Sokolmish:main

Conversation

@Sokolmish

Copy link
Copy Markdown
Contributor

Allow users to provide their own contexts for Dial() instead of using implicit Background().

I've taken the code from the previous abandoned PR and rebased it. Also I've added an option to test this functionality to the vscp utility.

Tested it this way. Stopped the VM using SIGSTOP and tried to connect to it with the vscp. With timeouts less than 3s context cancellation works as expected. With more than 3s the kernel aborts connect() itself, don't know if it's a rule though.

My test with more details:

# On the testVM (CID 43252)
socat VSOCK-LISTEN:5555,reuseaddr -   # Need to restart it after each connect

# On the hypervisor
kill -SIGSTOP <VM_PID>
./vscp -c 43252 -p 5555 -d 1s -s ./hello.txt   # Context deadline
kill -SIGCONT <VM_PID>
./vscp -c 43252 -p 5555 -d 1s -s ./hello.txt   # Works fine
image_2026-08-21_01-07-08

@SuperQ SuperQ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@SuperQ
SuperQ merged commit f5b7edf into mdlayher:main Oct 15, 2026
@mdlayher

Copy link
Copy Markdown
Owner

lgtm thanks!

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