Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/sinks/util/datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub async fn send_datagrams<E: Encoder<Event, Error = vector_lib::codecs::encodi
continue;
}

let mut socket_error = false;
let delivered = if let Some(chunker) = chunker {
let data_size = bytes.len();
match chunker.chunk(bytes.freeze()) {
Expand All @@ -55,6 +56,7 @@ pub async fn send_datagrams<E: Encoder<Event, Error = vector_lib::codecs::encodi
for bytes in chunks {
if !send_and_emit(&mut socket, &bytes, bytes_sent).await {
chunks_delivered = false;
socket_error = true;
break;
}
}
Expand All @@ -68,14 +70,20 @@ pub async fn send_datagrams<E: Encoder<Event, Error = vector_lib::codecs::encodi
false
}
}
} else if send_and_emit(&mut socket, &bytes.freeze(), bytes_sent).await {
true
} else {
send_and_emit(&mut socket, &bytes.freeze(), bytes_sent).await
socket_error = true;
false
};

if delivered {
finalizers.update_status(EventStatus::Delivered);
} else {
finalizers.update_status(EventStatus::Errored);
if socket_error {
return;
}
}
}
}
Expand Down