Serialize build retirement and clone classification, bound ops accepts
Review fixes for M7.6-M7.9. Schema v9 applies one lock order: the barrier takes a database-wide upgrade lock exclusively, while acquisitions, lease checks, provisioning and the retired-build trigger take it shared first, so a queued acquisition can no longer regain authority for a just-retired build and concurrent barriers cannot retire the last current build. Provisioning takes a per-world lock before classifying a world as original or a clone of one source. The operations listener makes at most four accept attempts per serve(). Race regressions prove each contender is blocked before commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,9 @@ enum class OpsError : std::uint8_t { address, socket };
|
||||
class OpsServer {
|
||||
public:
|
||||
static constexpr std::size_t max_connections = 8;
|
||||
// Accept attempts per serve(), refused ones included: sustained connection
|
||||
// pressure cannot hold the host loop; the rest wait in the listen backlog.
|
||||
static constexpr std::size_t max_accepts_per_serve = 4;
|
||||
static constexpr std::size_t max_request_bytes = 4096;
|
||||
static constexpr std::size_t max_response_bytes = 16384;
|
||||
static constexpr std::chrono::milliseconds connection_deadline{1000};
|
||||
@@ -42,13 +45,16 @@ class OpsServer {
|
||||
[[nodiscard]] std::uint16_t port() const noexcept {
|
||||
return port_;
|
||||
}
|
||||
// Accepts, reads, answers and expires connections without waiting. Connections
|
||||
// beyond the bound are closed at once; slow or oversized ones are answered or
|
||||
// dropped without delaying others.
|
||||
// Accepts at most max_accepts_per_serve connections, then reads, answers and
|
||||
// expires connections without waiting. Connections beyond the bound are closed
|
||||
// at once; slow or oversized ones are answered or dropped without delaying others.
|
||||
void serve(const OpsHandler& handler);
|
||||
[[nodiscard]] std::uint64_t refused() const noexcept {
|
||||
return refused_;
|
||||
}
|
||||
[[nodiscard]] std::size_t open_connections() const noexcept {
|
||||
return connections_.size();
|
||||
}
|
||||
|
||||
private:
|
||||
struct Connection {
|
||||
|
||||
Reference in New Issue
Block a user