vsock icon indicating copy to clipboard operation
vsock copied to clipboard

vsock: implemented DialContext

Open balena opened this issue 3 years ago • 5 comments

This PR simply implements a function DialContext so that a context can be used to terminate the dialing. VSOCK has lower chances to delay obtaining a response while dialing, but it can still occur.

Moreover, it is important to be supported while integrating with go-libp2p. Check github.com/balena/go-libp2p-vsock. It allows enclaves to dial remote libp2p nodes by means of relays.

balena avatar Feb 02 '23 00:02 balena

@mdlayher gentle bump

balena avatar Jan 04 '25 01:01 balena

I can't speak for every case around, but the same worked for AWS VSOCKs, which is definitely a sub case of the more general VSOCK support. Anyways, the context is being passed to the Connect function call that originally received an inlined context.Background() instance. It will be a matter for the Connect to honor the passed context or not.

balena avatar Jan 04 '25 21:01 balena

I'm actually not sure why actions isn't running here, let me see.

mdlayher avatar Jan 06 '25 18:01 mdlayher

I'm good with this but will want to get CI updated first. Will set a reminder.

mdlayher avatar Jan 06 '25 18:01 mdlayher

The placeholder function for !linux platforms is missing a context parameter:

diff --git a/vsock_others.go b/vsock_others.go
index 5c1e88e..d46fb90 100644
--- a/vsock_others.go
+++ b/vsock_others.go
@@ -4,6 +4,7 @@
 package vsock

 import (
+       "context"
        "fmt"
        "net"
        "os"
@@ -26,7 +27,7 @@ func (*listener) Addr() net.Addr                { return nil }
 func (*listener) Close() error                  { return errUnimplemented }
 func (*listener) SetDeadline(_ time.Time) error { return errUnimplemented }

-func dial(_, _ uint32, _ *Config) (*Conn, error) { return nil, errUnimplemented }
+func dial(_ context.Context, _, _ uint32, _ *Config) (*Conn, error) { return nil, errUnimplemented }

 type conn struct{}

natesales avatar Jan 15 '25 07:01 natesales