Clear the open minors: lost marking and overrun logging, form teardown guard, line breaks and ERANGE in config, probe strength
The E-1608 source marks every restart as lost and logs each overrun; its form stops touching siblings after the chooser destroys them; the link skips command id 0, retries a full-buffer discover send and ignores a zero-length scan read. Session files escape \n and \r; get_int and get_double reject out-of-range values; the UDPS port spin reports changes; a skipped source panel says why on stderr. The E-1608 probe now checks the signal names and the reconnect itself. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
6245811699
commit
87822ed4f5
9 files changed
+95
-18
No files matched your search
@@ -199,9 +199,16 @@ std::vector<DeviceInfo> discover(const std::vector<std::string>& targets, int po
|
||||
} catch (const LinkError&) {
|
||||
continue;
|
||||
}
|
||||
// A sweep may hit unreachable hosts; those sends fail and are simply skipped.
|
||||
(void)::sendto(u.get(), &probe, 1, MSG_NOSIGNAL, reinterpret_cast<const sockaddr*>(&a),
|
||||
sizeof a);
|
||||
// A sweep may hit unreachable hosts; those sends fail and are simply skipped. A full send
|
||||
// buffer is not that: wait for room once and retry, so a large sweep does not lose probes.
|
||||
const auto send_probe = [&] {
|
||||
return ::sendto(u.get(), &probe, 1, MSG_NOSIGNAL, reinterpret_cast<const sockaddr*>(&a),
|
||||
sizeof a);
|
||||
};
|
||||
if (send_probe() < 0 && (errno == EAGAIN || errno == ENOBUFS)) {
|
||||
wait_fd(u.get(), POLLOUT, 20);
|
||||
(void)send_probe();
|
||||
}
|
||||
}
|
||||
const auto deadline = Clock::now() + std::chrono::milliseconds(wait_ms);
|
||||
for (;;) {
|
||||
@@ -288,7 +295,8 @@ std::vector<std::uint8_t> Link::command(std::uint8_t cmd, const std::vector<std:
|
||||
while (::recv(cmd_.get(), junk, sizeof junk, MSG_DONTWAIT) > 0) {
|
||||
}
|
||||
}
|
||||
const std::uint8_t id = ++next_id_;
|
||||
if (++next_id_ == 0) next_id_ = 1; // id 0 is never used, in case a board treats it specially
|
||||
const std::uint8_t id = next_id_;
|
||||
std::vector<std::uint8_t> f;
|
||||
f.reserve(7 + payload.size());
|
||||
f.push_back(0xDB);
|
||||
@@ -349,6 +357,7 @@ void Link::send_filler() {
|
||||
|
||||
std::size_t Link::read_scan(std::uint8_t* buf, std::size_t cap, int timeout_ms) {
|
||||
if (!scan_.valid()) throw LinkError(Kind::Io, "the scan socket is not open");
|
||||
if (cap == 0) return 0; // recv would return 0 and read as a close
|
||||
if (!wait_fd(scan_.get(), POLLIN, timeout_ms)) return 0;
|
||||
const ssize_t n = ::recv(scan_.get(), buf, cap, MSG_DONTWAIT);
|
||||
if (n > 0) return static_cast<std::size_t>(n);
|
||||
|
||||
Reference in new issue
Block a user