mirror of
https://github.com/n0-computer/iroh.git
synced 2026-12-03 00:01:30 +00:00
deploy: 653bca2ab1f68a6bab92e883329a0b8b5ce1b7d7
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -509,9 +509,6 @@
|
||||
<a href="#509" id="509">509</a>
|
||||
<a href="#510" id="510">510</a>
|
||||
<a href="#511" id="511">511</a>
|
||||
<a href="#512" id="512">512</a>
|
||||
<a href="#513" id="513">513</a>
|
||||
<a href="#514" id="514">514</a>
|
||||
</pre></div><pre class="rust"><code><span class="doccomment">//! based on tailscale/derp/derp_client.go
|
||||
</span><span class="kw">use </span>std::net::SocketAddr;
|
||||
<span class="kw">use </span>std::pin::Pin;
|
||||
@@ -562,7 +559,7 @@
|
||||
}
|
||||
|
||||
<span class="attr">#[derive(Debug)]
|
||||
</span><span class="kw">pub struct </span>ClientReceiver {
|
||||
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>ClientReceiver {
|
||||
<span class="doccomment">/// The reader channel, receiving incoming messages.
|
||||
</span>reader_channel: mpsc::Receiver<<span class="prelude-ty">Result</span><ReceivedMessage>>,
|
||||
}
|
||||
@@ -954,7 +951,7 @@
|
||||
|
||||
<span class="attr">#[derive(derive_more::Debug, Clone)]
|
||||
</span><span class="doccomment">/// The type of message received by the [`ClientReceiver`] from a relay server.
|
||||
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">enum </span>ReceivedMessage {
|
||||
</span><span class="kw">pub enum </span>ReceivedMessage {
|
||||
<span class="doccomment">/// Represents an incoming packet.
|
||||
</span>ReceivedPacket {
|
||||
<span class="doccomment">/// The [`PublicKey`] of the packet sender.
|
||||
@@ -984,20 +981,17 @@
|
||||
///
|
||||
/// The default condition is healthy, so the server doesn't broadcast a [`ReceivedMessage::Health`]
|
||||
/// until a problem exists.
|
||||
</span><span class="attr">#[allow(unused)]
|
||||
</span>problem: <span class="prelude-ty">Option</span><String>,
|
||||
},
|
||||
<span class="doccomment">/// A one-way message from server to client, advertising that the server is restarting.
|
||||
</span>ServerRestarting {
|
||||
<span class="doccomment">/// An advisory duration that the client should wait before attempting to reconnect.
|
||||
/// It might be zero. It exists for the server to smear out the reconnects.
|
||||
</span><span class="attr">#[allow(unused)]
|
||||
</span>reconnect_in: Duration,
|
||||
<span class="doccomment">/// An advisory duration for how long the client should attempt to reconnect
|
||||
/// before giving up and proceeding with its normal connection failure logic. The interval
|
||||
/// between retries is undefined for now. A server should not send a TryFor duration more
|
||||
/// than a few seconds.
|
||||
</span><span class="attr">#[allow(unused)]
|
||||
</span>try_for: Duration,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1489,7 +1489,7 @@
|
||||
<span class="kw">impl </span>ClientReceiver {
|
||||
<span class="doccomment">/// Reads a message from the server. Returns the message and the `conn_get`, or the number of
|
||||
/// re-connections this Client has ever made
|
||||
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">async fn </span>recv(<span class="kw-2">&mut </span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><<span class="prelude-ty">Result</span><(ReceivedMessage, usize), ClientError>> {
|
||||
</span><span class="kw">pub async fn </span>recv(<span class="kw-2">&mut </span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><<span class="prelude-ty">Result</span><(ReceivedMessage, usize), ClientError>> {
|
||||
<span class="self">self</span>.msg_receiver.recv().<span class="kw">await
|
||||
</span>}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user