Skip to content

Commit

Permalink
fix use of updated websocketpp and boost
Browse files Browse the repository at this point in the history
  • Loading branch information
CamJN committed Dec 29, 2024
1 parent 6aca17b commit 77ff6df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
7 changes: 3 additions & 4 deletions src/agent/Core/AdminPanelConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#define _PASSENGER_ADMIN_PANEL_CONNECTOR_H_

#include <sys/wait.h>
#include <sstream>
#include <unistd.h>

#include <boost/scoped_ptr.hpp>
Expand Down Expand Up @@ -197,14 +196,14 @@ class AdminPanelConnector {
try {
runInternalRubyTool(*resourceLocator, ruby, args, &status, &output);
} catch (const std::exception &e) {
server.getIoService().post(boost::bind(
boost::asio::post(boost::bind(
&AdminPanelConnector::onGetServerPropertiesDone, this,
conn, doc, string(), -1, e.what()
));
return;
}

server.getIoService().post(boost::bind(
boost::asio::post(boost::bind(
&AdminPanelConnector::onGetServerPropertiesDone, this,
conn, doc, output.data, status, string()
));
Expand Down Expand Up @@ -294,7 +293,7 @@ class AdminPanelConnector {

void onGetGlobalConfigurationBgJob(const ConnectionPtr &conn, const Json::Value &input) {
Json::Value globalConfig = configGetter()["config_manifest"]["effective_value"]["global_configuration"];
server.getIoService().post(boost::bind(
boost::asio::post(boost::bind(
&AdminPanelConnector::onGetGlobalConfigDone, this,
conn, input, globalConfig
));
Expand Down
23 changes: 11 additions & 12 deletions src/cxx_supportlib/WebSocketCommandReverseServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <oxt/backtrace.hpp>
#include <oxt/macros.hpp>

#include <string>
#include <vector>
#include <deque>
#include <cstring>
Expand Down Expand Up @@ -256,8 +255,8 @@ class WebSocketCommandReverseServer {
};

struct ConfigChangeRequest {
boost::scoped_ptr<ConfigKit::Store> config;
boost::scoped_ptr<ConfigRealization> configRlz;
boost::asio::detail::scoped_ptr<ConfigKit::Store> config;
boost::asio::detail::scoped_ptr<ConfigRealization> configRlz;
};

typedef websocketpp::client<websocketpp::config::asio_client> Endpoint;
Expand Down Expand Up @@ -286,7 +285,7 @@ class WebSocketCommandReverseServer {

Endpoint endpoint;
ConnectionPtr conn;
boost::shared_ptr<boost::asio::deadline_timer> timer;
boost::shared_ptr<boost::asio::steady_timer> timer;
MessageHandler messageHandler;
Callback shutdownCallback;
mutable boost::mutex stateSyncher;
Expand Down Expand Up @@ -601,7 +600,7 @@ class WebSocketCommandReverseServer {
}

void restartTimer(unsigned int ms) {
timer->expires_from_now(boost::posix_time::milliseconds(ms));
timer->expires_after(std::chrono::milliseconds(ms));
timer->async_wait(boost::bind(
&WebSocketCommandReverseServer::onTimeout,
this,
Expand Down Expand Up @@ -806,7 +805,7 @@ class WebSocketCommandReverseServer {
void initialize() {
endpoint.init_asio();
state = NOT_CONNECTED;
timer = boost::make_shared<boost::asio::deadline_timer, boost::asio::io_service &>(
timer = boost::make_shared<boost::asio::steady_timer, boost::asio::io_context &>(
endpoint.get_io_service());
startConnect();
}
Expand All @@ -833,7 +832,7 @@ class WebSocketCommandReverseServer {
return config;
}

boost::asio::io_service &getIoService() {
boost::asio::execution_context &getIoService() {
return endpoint.get_io_service();
}

Expand Down Expand Up @@ -863,7 +862,7 @@ class WebSocketCommandReverseServer {
ConfigChangeRequest &req,
const ConfigKit::CallbackTypes<WebSocketCommandReverseServer>::PrepareConfigChange &callback)
{
endpoint.get_io_service().post(boost::bind(
boost::asio::post(boost::bind(
ConfigKit::callPrepareConfigChangeAndCallback<WebSocketCommandReverseServer>,
this, updates, &req, callback));
}
Expand All @@ -872,19 +871,19 @@ class WebSocketCommandReverseServer {
const ConfigKit::CallbackTypes<WebSocketCommandReverseServer>::CommitConfigChange &callback)
BOOST_NOEXCEPT_OR_NOTHROW
{
endpoint.get_io_service().post(boost::bind(
boost::asio::post(boost::bind(
ConfigKit::callCommitConfigChangeAndCallback<WebSocketCommandReverseServer>,
this, &req, callback));
}

void asyncInspectConfig(const ConfigKit::CallbackTypes<WebSocketCommandReverseServer>::InspectConfig &callback) {
endpoint.get_io_service().post(boost::bind(
boost::asio::post(boost::bind(
ConfigKit::callInspectConfigAndCallback<WebSocketCommandReverseServer>,
this, callback));
}

void asyncInspectState(const InspectCallback &callback) {
endpoint.get_io_service().post(boost::bind(
boost::asio::post(boost::bind(
&WebSocketCommandReverseServer::internalInspectState,
this, callback));
}
Expand All @@ -899,7 +898,7 @@ class WebSocketCommandReverseServer {
* This method is thread-safe and may be called from any thread.
*/
void asyncShutdown(const Callback &callback = Callback()) {
endpoint.get_io_service().post(boost::bind(
boost::asio::post(boost::bind(
&WebSocketCommandReverseServer::internalShutdown,
this, callback));
}
Expand Down

0 comments on commit 77ff6df

Please sign in to comment.