(ctx context.Context, data wshrpc.CommandConnServerInitData)
| 104 | } |
| 105 | |
| 106 | func (impl *ServerImpl) ConnServerInitCommand(ctx context.Context, data wshrpc.CommandConnServerInitData) error { |
| 107 | if data.ClientId == "" { |
| 108 | return fmt.Errorf("clientid is required") |
| 109 | } |
| 110 | if impl.SockName == "" { |
| 111 | return fmt.Errorf("sockname not set in server impl") |
| 112 | } |
| 113 | symlinkPath, err := wavebase.ExpandHomeDir(wavebase.GetPersistentRemoteSockName(data.ClientId)) |
| 114 | if err != nil { |
| 115 | return fmt.Errorf("cannot expand symlink path: %w", err) |
| 116 | } |
| 117 | symlinkDir := filepath.Dir(symlinkPath) |
| 118 | |
| 119 | if err := os.MkdirAll(symlinkDir, 0700); err != nil { |
| 120 | return fmt.Errorf("could not create client directory %s: %w", symlinkDir, err) |
| 121 | } |
| 122 | os.Remove(symlinkPath) |
| 123 | if err := os.Symlink(impl.SockName, symlinkPath); err != nil { |
| 124 | return fmt.Errorf("could not create symlink %s -> %s: %w", symlinkPath, impl.SockName, err) |
| 125 | } |
| 126 | impl.Log("created symlink %s -> %s\n", symlinkPath, impl.SockName) |
| 127 | return nil |
| 128 | } |
| 129 | |
| 130 | func (impl *ServerImpl) getWshPath() (string, error) { |
| 131 | if impl.IsLocal { |
nothing calls this directly
no test coverage detected