Skip to content

Commit

Permalink
Treat parse failures as fatal connection errors.
Browse files Browse the repository at this point in the history
A common failure mode is if dump978/faup978 has been pointed at a
1090 data source; we don't want to continually spam errors in this
case.
  • Loading branch information
mutability committed Nov 2, 2021
1 parent 8f71fef commit ae2994f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
dump978-fa (7.0~dev) UNRELEASED; urgency=medium

* In development
* Treat parse failures as fatal connection errors (a common failure mode is if
dump978/faup978 has been pointed at a 1090 data source; we don't want to
continually spam errors in this case)

-- Eric Tran <eric.tran@flightaware.com> Fri, 24 Sep 2021 15:35:25 +0000
-- Oliver Jowett <oliver.jowett@flightaware.com> Tue, 02 Nov 2021 12:46:24 +0800

dump978-fa (6.1) stable; urgency=medium

Expand Down
7 changes: 6 additions & 1 deletion socket_input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ void RawInput::TryNextEndpoint(const boost::system::error_code &last_error) {
void RawInput::ScheduleRead() {
auto self(shared_from_this());

if (!socket_.is_open())
return;

if (used_ >= readbuf_.size()) {
HandleError(boost::asio::error::make_error_code(boost::asio::error::no_buffer_space));
return;
Expand Down Expand Up @@ -119,7 +122,9 @@ void RawInput::ParseBuffer() {
}
messages->emplace_back(std::move(*result));
} else {
std::cerr << "warning: failed to parse input line: " << line << std::endl;
std::cerr << "error: failed to parse input line: " << line << std::endl;
HandleError(boost::system::errc::make_error_code(boost::system::errc::protocol_error));
return;
}
sol = eol + 1;
}
Expand Down

0 comments on commit ae2994f

Please sign in to comment.