(msc *MainServerConn)
| 351 | } |
| 352 | |
| 353 | func (jm *JobManager) StartStream(msc *MainServerConn) error { |
| 354 | jm.lock.Lock() |
| 355 | defer jm.lock.Unlock() |
| 356 | |
| 357 | if jm.Cmd == nil { |
| 358 | return fmt.Errorf("job not started") |
| 359 | } |
| 360 | if jm.pendingStreamMeta == nil { |
| 361 | return fmt.Errorf("no pending stream (call PrepareConnect first)") |
| 362 | } |
| 363 | |
| 364 | err := msc.WshRpc.StreamBroker.AttachStreamWriter(jm.pendingStreamMeta, jm.StreamManager) |
| 365 | if err != nil { |
| 366 | return fmt.Errorf("failed to attach stream writer: %w", err) |
| 367 | } |
| 368 | |
| 369 | err = jm.StreamManager.SetRwndSize(int(jm.pendingStreamMeta.RWnd)) |
| 370 | if err != nil { |
| 371 | return fmt.Errorf("failed to set rwnd size: %w", err) |
| 372 | } |
| 373 | |
| 374 | log.Printf("StartStream: streamid=%s rwnd=%d streaming started\n", jm.pendingStreamMeta.Id, jm.pendingStreamMeta.RWnd) |
| 375 | jm.pendingStreamMeta = nil |
| 376 | return nil |
| 377 | } |
| 378 | |
| 379 | func MakeJobDomainSocket(clientId string, jobId string) error { |
| 380 | socketDir := filepath.Join("/tmp", fmt.Sprintf("waveterm-%d", os.Getuid())) |
no test coverage detected