| 121 | } |
| 122 | |
| 123 | pub fn blocking_bind( |
| 124 | &self, |
| 125 | network: &Network, |
| 126 | local_address: IpSocketAddress, |
| 127 | ) -> Result<(), ErrorCode> { |
| 128 | let timeout = monotonic_clock::subscribe_duration(TIMEOUT_NS); |
| 129 | let sub = self.subscribe(); |
| 130 | |
| 131 | self.start_bind(&network, local_address)?; |
| 132 | |
| 133 | loop { |
| 134 | match self.finish_bind() { |
| 135 | Err(ErrorCode::WouldBlock) => sub.block_until(&timeout)?, |
| 136 | result => return result, |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | pub fn blocking_listen(&self) -> Result<(), ErrorCode> { |
| 142 | let timeout = monotonic_clock::subscribe_duration(TIMEOUT_NS); |