(
socket_rx: &Receiver<PgDumpVirtualSocket>,
runner: &thread::JoinHandle<Result<String>>,
)
| 525 | } |
| 526 | |
| 527 | fn receive_direct_pg_dump_socket( |
| 528 | socket_rx: &Receiver<PgDumpVirtualSocket>, |
| 529 | runner: &thread::JoinHandle<Result<String>>, |
| 530 | ) -> Result<PgDumpVirtualSocket> { |
| 531 | let started = Instant::now(); |
| 532 | loop { |
| 533 | match socket_rx.recv_timeout(Duration::from_millis(5)) { |
| 534 | Ok(socket) => return Ok(socket), |
| 535 | Err(mpsc::RecvTimeoutError::Timeout) => { |
| 536 | if runner.is_finished() { |
| 537 | bail!("pg_dump exited before opening the direct virtual protocol connection"); |
| 538 | } |
| 539 | if started.elapsed() > Duration::from_secs(30) { |
| 540 | bail!( |
| 541 | "timed out waiting for pg_dump to open the direct virtual protocol connection" |
| 542 | ); |
| 543 | } |
| 544 | } |
| 545 | Err(mpsc::RecvTimeoutError::Disconnected) => { |
| 546 | bail!("pg_dump direct virtual networking channel closed before connect") |
| 547 | } |
| 548 | } |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | #[derive(Debug)] |
| 553 | struct CaptureFile { |
no test coverage detected