Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnek committed Jan 15, 2024
1 parent 11e9cc0 commit 3880142
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions quinn-proto/src/connection/datagrams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ pub struct Datagrams<'a> {
impl<'a> Datagrams<'a> {
/// Queue an unreliable, unordered datagram for immediate transmission
///
/// If `drop` is true, previously queued datagrams which are still unsent will be discarded to
/// make space for this datagram. If `drop` is false, and there isn't enough space due to
/// previously queued datagrams, this function will return `SendDatagramError::Blocked`
///
/// Returns `Err` iff a `len`-byte datagram cannot currently be sent
///
/// If `drop` is true, previously queued datagrams which are still unsent may be discarded to
/// make space for this datagram, in order of oldest to newest. If `drop` is false, and there
/// isn't enough space due to previously queued datagrams, this function will return
/// `SendDatagramError::Blocked`.
pub fn send(&mut self, data: Bytes, drop: bool) -> Result<(), SendDatagramError> {
if self.conn.config.datagram_receive_buffer_size.is_none() {
return Err(SendDatagramError::Disabled);
Expand Down Expand Up @@ -153,7 +154,6 @@ impl DatagramState {
}

self.outgoing_total -= datagram.data.len();
self.send_blocked = false;
datagram.encode(true, buf);
true
}
Expand Down
4 changes: 2 additions & 2 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3095,7 +3095,6 @@ impl Connection {
}

// DATAGRAM
let datagram_send_was_blocked = self.datagrams.send_blocked;
let mut sent_datagrams = false;
while buf.len() + Datagram::SIZE_BOUND < max_size && space_id == SpaceId::Data {
match self.datagrams.write(buf, max_size) {
Expand All @@ -3107,8 +3106,9 @@ impl Connection {
false => break,
}
}
if datagram_send_was_blocked && sent_datagrams {
if self.datagrams.send_blocked && sent_datagrams {
self.events.push_back(Event::DatagramSent);
self.datagrams.send_blocked = false;
}

// STREAM
Expand Down

0 comments on commit 3880142

Please sign in to comment.