Skip to content

vsock: implement DialContext - #78

Open
Sokolmish wants to merge 1 commit into
mdlayher:mainfrom
Sokolmish:main
Open

vsock: implement DialContext#78
Sokolmish wants to merge 1 commit into
mdlayher:mainfrom
Sokolmish:main

Conversation

@Sokolmish

Copy link
Copy Markdown

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

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.

1 participant