MCPcopy Create free account
hub / github.com/apache/arrow / Serve

Method Serve

cpp/src/arrow/flight/server.cc:175–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175Status FlightServerBase::Serve() {
176 if (!impl_->transport_) {
177 return Status::UnknownError("Server did not start properly");
178 }
179 impl_->got_signal_ = 0;
180 impl_->old_signal_handlers_.clear();
181 impl_->running_instance_ = impl_.get();
182
183 ServerSignalHandler signal_handler;
184 ARROW_ASSIGN_OR_RAISE(impl_->self_pipe_, signal_handler.Init(&Impl::WaitForSignals));
185 // Override existing signal handlers with our own handler so as to stop the server.
186 for (size_t i = 0; i < impl_->signals_.size(); ++i) {
187 int signum = impl_->signals_[i];
188 SignalHandler new_handler(&Impl::HandleSignal), old_handler;
189 ARROW_ASSIGN_OR_RAISE(old_handler, SetSignalHandler(signum, new_handler));
190 impl_->old_signal_handlers_.push_back(std::move(old_handler));
191 }
192
193 RETURN_NOT_OK(impl_->transport_->Wait());
194 impl_->running_instance_ = nullptr;
195
196 // Restore signal handlers
197 for (size_t i = 0; i < impl_->signals_.size(); ++i) {
198 RETURN_NOT_OK(
199 SetSignalHandler(impl_->signals_[i], impl_->old_signal_handlers_[i]).status());
200 }
201 return Status::OK();
202}
203
204int FlightServerBase::GotSignal() const { return impl_->got_signal_; }
205

Callers 7

mainFunction · 0.80
mainFunction · 0.80
TestShutdownMethod · 0.80
mainFunction · 0.80
RunMainFunction · 0.80
RunMainFunction · 0.80
RunFlightGrpcFunction · 0.80

Calls 11

UnknownErrorFunction · 0.85
SetSignalHandlerFunction · 0.85
push_backMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
OKFunction · 0.50
clearMethod · 0.45
getMethod · 0.45
InitMethod · 0.45
sizeMethod · 0.45
WaitMethod · 0.45
statusMethod · 0.45

Tested by 4

mainFunction · 0.64
TestShutdownMethod · 0.64
mainFunction · 0.64
RunMainFunction · 0.64