(&self)
| 171 | } |
| 172 | |
| 173 | pub fn blocking_accept(&self) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode> { |
| 174 | let timeout = monotonic_clock::subscribe_duration(TIMEOUT_NS); |
| 175 | let sub = self.subscribe(); |
| 176 | |
| 177 | loop { |
| 178 | match self.accept() { |
| 179 | Err(ErrorCode::WouldBlock) => sub.block_until(&timeout)?, |
| 180 | result => return result, |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | impl UdpSocket { |