safesocket: add ConnectContext
This adds a variant for Connect that takes in a context.Context which allows passing through cancellation etc by the caller. Updates tailscale/corp#18266 Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
package safesocket
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
@ -85,7 +86,7 @@ func (fc plan9FileConn) SetWriteDeadline(t time.Time) error {
|
||||
return syscall.EPLAN9
|
||||
}
|
||||
|
||||
func connect(path string) (net.Conn, error) {
|
||||
func connect(_ context.Context, path string) (net.Conn, error) {
|
||||
f, err := os.OpenFile(path, os.O_RDWR, 0666)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user