(ctx context.Context, sess *daggerSession)
| 1993 | } |
| 1994 | |
| 1995 | func (srv *Server) sessionMainClientConn(ctx context.Context, sess *daggerSession) (*grpc.ClientConn, error) { |
| 1996 | _ = ctx |
| 1997 | if sess == nil { |
| 1998 | return nil, errors.New("session is nil") |
| 1999 | } |
| 2000 | client, err := srv.clientFromIDs(sess.sessionID, sess.mainClientCallerID) |
| 2001 | if err != nil { |
| 2002 | return nil, fmt.Errorf("failed to get main client %q: %w", sess.mainClientCallerID, err) |
| 2003 | } |
| 2004 | caller, err := client.getClientCaller(ctx, sess.mainClientCallerID) |
| 2005 | if err != nil { |
| 2006 | return nil, fmt.Errorf("failed to get main client caller %q: %w", sess.mainClientCallerID, err) |
| 2007 | } |
| 2008 | if caller == nil { |
| 2009 | return nil, fmt.Errorf("main client caller %q was nil", sess.mainClientCallerID) |
| 2010 | } |
| 2011 | conn := caller.Conn() |
| 2012 | if conn == nil { |
| 2013 | return nil, fmt.Errorf("main client conn %q was nil", sess.mainClientCallerID) |
| 2014 | } |
| 2015 | return conn, nil |
| 2016 | } |
| 2017 | |
| 2018 | // The nearest ancestor client that is not a module (either a caller from the host like the CLI |
| 2019 | // or a nested exec). Useful for figuring out where local sources should be resolved from through |
no test coverage detected