(ctx context.Context, clientID string, opts core.SpecificClientAttachableConnOpts)
| 1963 | } |
| 1964 | |
| 1965 | func (srv *Server) SpecificClientAttachableConn(ctx context.Context, clientID string, opts core.SpecificClientAttachableConnOpts) (*grpc.ClientConn, bool, error) { |
| 1966 | client, err := srv.clientFromContext(ctx) |
| 1967 | if err != nil { |
| 1968 | return nil, false, err |
| 1969 | } |
| 1970 | |
| 1971 | var caller engineutil.SessionCaller |
| 1972 | if opts.IfAvailable { |
| 1973 | var ok bool |
| 1974 | caller, ok = client.daggerSession.attachables.Lookup(clientID) |
| 1975 | if !ok { |
| 1976 | return nil, false, nil |
| 1977 | } |
| 1978 | } else { |
| 1979 | caller, err = client.getClientCaller(ctx, clientID) |
| 1980 | if err != nil { |
| 1981 | return nil, false, fmt.Errorf("failed to get session attachable caller for client %q: %w", clientID, err) |
| 1982 | } |
| 1983 | if caller == nil { |
| 1984 | return nil, false, fmt.Errorf("session attachable caller for client %q was nil", clientID) |
| 1985 | } |
| 1986 | } |
| 1987 | |
| 1988 | conn := caller.Conn() |
| 1989 | if conn == nil { |
| 1990 | return nil, false, fmt.Errorf("session attachable conn for client %q was nil", clientID) |
| 1991 | } |
| 1992 | return conn, true, nil |
| 1993 | } |
| 1994 | |
| 1995 | func (srv *Server) sessionMainClientConn(ctx context.Context, sess *daggerSession) (*grpc.ClientConn, error) { |
| 1996 | _ = ctx |
nothing calls this directly
no test coverage detected