Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make http client restart requests #1883

Closed
wants to merge 9 commits into from
16 changes: 8 additions & 8 deletions tests/unit/loopback_socket.hh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public:
return make_exception_future<>(std::runtime_error("test injected glitch on send"));
}
if (error == loopback_error_injector::error::abort) {
shutdown();
abort();
return make_exception_future<>(std::runtime_error("test injected error on send"));
}
}
Expand All @@ -85,13 +85,13 @@ public:
return make_exception_future<temporary_buffer<char>>(std::runtime_error("test injected glitch on receive"));
}
if (error == loopback_error_injector::error::abort) {
shutdown();
abort();
return make_exception_future<temporary_buffer<char>>(std::runtime_error("test injected error on receive"));
}
}
return _q.pop_eventually();
}
void shutdown() noexcept {
void abort() noexcept {
nyh marked this conversation as resolved.
Show resolved Hide resolved
if (!_aborted) {
// it can be called by both -- reader and writer socket impls
_shutdown.set_value();
Expand Down Expand Up @@ -159,7 +159,7 @@ public:
}
future<> close() override {
if (!_eof) {
_buffer->shutdown();
_buffer->abort();
}
return make_ready_future<>();
}
Expand All @@ -180,11 +180,11 @@ public:
return data_sink(std::make_unique<loopback_data_sink_impl>(_tx, [this] { shutdown_input(); }));
}
void shutdown_input() override {
_rx->shutdown();
_rx->abort();
}
void shutdown_output() override {
(void)smp::submit_to(_tx->get_owner_shard(), [tx = _tx] {
(*tx)->shutdown();
(*tx)->abort();
});
}
void set_nodelay(bool nodelay) override {
Expand Down Expand Up @@ -330,9 +330,9 @@ public:
_connect_abort->set_exception(std::make_exception_ptr(std::system_error(ECONNABORTED, std::system_category())));
_connect_abort = std::nullopt;
} else {
_b1->shutdown();
_b1->abort();
(void)smp::submit_to(_b2.get_owner_shard(), [b2 = std::move(_b2)] {
b2->shutdown();
b2->abort();
});
}
}
Expand Down