Skip to content

Commit

Permalink
rename to connmgr
Browse files Browse the repository at this point in the history
  • Loading branch information
jkarneges committed May 24, 2024
1 parent 6075949 commit 7ad3722
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 113 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ name = "client"
harness = false

[[bin]]
name = "pushpin-cm"
name = "pushpin-connmgr"
test = false
bench = false

Expand Down
2 changes: 1 addition & 1 deletion examples/config/pushpin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ stats_connection_send=true

[runner]
# services to start
services=cm,pushpin-proxy,pushpin-handler
services=connmgr,pushpin-proxy,pushpin-handler

# plain HTTP port to listen on for client connections
http_port=7999
Expand Down
12 changes: 6 additions & 6 deletions postbuild/postbuild.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ RELEASE = $$(RELEASE)

# copy bin files

cm_bin.target = $$bin_dir/pushpin-cm
cm_bin.depends = $$target_dir/pushpin-cm
cm_bin.commands = mkdir -p $$bin_dir && cp -a $$target_dir/pushpin-cm $$bin_dir/pushpin-cm
connmgr_bin.target = $$bin_dir/pushpin-connmgr
connmgr_bin.depends = $$target_dir/pushpin-connmgr
connmgr_bin.commands = mkdir -p $$bin_dir && cp -a $$target_dir/pushpin-connmgr $$bin_dir/pushpin-connmgr

m2adapter_bin.target = $$bin_dir/m2adapter
m2adapter_bin.depends = $$target_dir/m2adapter
Expand All @@ -44,7 +44,7 @@ publish_bin.depends = $$target_dir/pushpin-publish
publish_bin.commands = mkdir -p $$bin_dir && cp -a $$target_dir/pushpin-publish $$bin_dir/pushpin-publish

QMAKE_EXTRA_TARGETS += \
cm_bin \
connmgr_bin \
m2adapter_bin \
proxy_bin \
handler_bin \
Expand All @@ -53,7 +53,7 @@ QMAKE_EXTRA_TARGETS += \
publish_bin

PRE_TARGETDEPS += \
$$bin_dir/pushpin-cm \
$$bin_dir/pushpin-connmgr \
$$bin_dir/m2adapter \
$$bin_dir/pushpin-proxy \
$$bin_dir/pushpin-handler \
Expand All @@ -75,7 +75,7 @@ PRE_TARGETDEPS += pushpin.conf.inst
unix:!isEmpty(BINDIR) {
binfiles.path = $$BINDIR
binfiles.files = \
$$bin_dir/pushpin-cm \
$$bin_dir/pushpin-connmgr \
$$bin_dir/m2adapter \
$$bin_dir/pushpin-proxy \
$$bin_dir/pushpin-handler \
Expand Down
6 changes: 3 additions & 3 deletions src/bin/pushpin-cm.rs → src/bin/pushpin-connmgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use clap::{Arg, ArgAction, Command};
use log::{error, LevelFilter};
use pushpin::cm::{run, App, Config};
use pushpin::connmgr::{run, App, Config};
use pushpin::log::{get_simple_logger, local_offset_check};
use pushpin::version;
use pushpin::{ListenConfig, ListenSpec};
Expand Down Expand Up @@ -199,7 +199,7 @@ fn process_args_and_run(args: Args) -> Result<(), Box<dyn Error>> {
}

fn main() {
let matches = Command::new("pushpin-cm")
let matches = Command::new("pushpin-connmgr")
.version(version())
.about("HTTP/WebSocket connection manager")
.arg(
Expand All @@ -216,7 +216,7 @@ fn main() {
.num_args(1)
.value_name("ID")
.help("Instance ID")
.default_value("cm"),
.default_value("connmgr"),
)
.arg(
Arg::new("workers")
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ impl CustomConfig {
"runner",
Runner {
rundir: String::new(),
services: String::from("cm,pushpin-proxy,pushpin-handler"),
services: String::from("connmgr,pushpin-proxy,pushpin-handler"),
http_port: String::from("7999"),
https_ports: String::from("443"),
local_ports: String::from("{rundir}/{ipc_prefix}server"),
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/cpp/cpp.pri
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ HEADERS += \
$$RSRC_DIR/template.h \
$$RSRC_DIR/service.h \
$$RSRC_DIR/listenport.h \
$$RSRC_DIR/cmservice.h \
$$RSRC_DIR/connmgrservice.h \
$$RSRC_DIR/mongrel2service.h \
$$RSRC_DIR/m2adapterservice.h \
$$RSRC_DIR/zurlservice.h \
Expand All @@ -239,7 +239,7 @@ HEADERS += \
SOURCES += \
$$RSRC_DIR/template.cpp \
$$RSRC_DIR/service.cpp \
$$RSRC_DIR/cmservice.cpp \
$$RSRC_DIR/connmgrservice.cpp \
$$RSRC_DIR/mongrel2service.cpp \
$$RSRC_DIR/m2adapterservice.cpp \
$$RSRC_DIR/zurlservice.cpp \
Expand Down
18 changes: 9 additions & 9 deletions src/cpp/handler/handlerapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,16 @@ class HandlerApp::Private : public QObject

QStringList services = settings.value("runner/services").toStringList();

QStringList cm_in_stream_specs = settings.value("proxy/cm_in_stream_specs").toStringList();
trimlist(&cm_in_stream_specs);
QStringList cm_out_specs = settings.value("proxy/cm_out_specs").toStringList();
trimlist(&cm_out_specs);
QStringList connmgr_in_stream_specs = settings.value("proxy/connmgr_in_stream_specs").toStringList();
trimlist(&connmgr_in_stream_specs);
QStringList connmgr_out_specs = settings.value("proxy/connmgr_out_specs").toStringList();
trimlist(&connmgr_out_specs);
QStringList condure_in_stream_specs = settings.value("proxy/condure_in_stream_specs").toStringList();
trimlist(&condure_in_stream_specs);
cm_in_stream_specs += condure_in_stream_specs;
connmgr_in_stream_specs += condure_in_stream_specs;
QStringList condure_out_specs = settings.value("proxy/condure_out_specs").toStringList();
trimlist(&condure_out_specs);
cm_out_specs += condure_out_specs;
connmgr_out_specs += condure_out_specs;
int proxyWorkerCount = settings.value("proxy/workers", 1).toInt();
QStringList m2a_in_stream_specs = settings.value("handler/m2a_in_stream_specs").toStringList();
trimlist(&m2a_in_stream_specs);
Expand Down Expand Up @@ -354,10 +354,10 @@ class HandlerApp::Private : public QObject
HandlerEngine::Configuration config;
config.appVersion = Config::get().version;
config.instanceId = "pushpin-handler_" + QByteArray::number(QCoreApplication::applicationPid());
if(!services.contains("mongrel2") && (!cm_in_stream_specs.isEmpty() || !cm_out_specs.isEmpty()))
if(!services.contains("mongrel2") && (!connmgr_in_stream_specs.isEmpty() || !connmgr_out_specs.isEmpty()))
{
config.serverInStreamSpecs = cm_in_stream_specs;
config.serverOutSpecs = cm_out_specs;
config.serverInStreamSpecs = connmgr_in_stream_specs;
config.serverOutSpecs = connmgr_out_specs;
}
else
{
Expand Down
60 changes: 30 additions & 30 deletions src/cpp/proxy/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,42 +425,42 @@ class App::Private : public QObject
QStringList services = settings.value("runner/services").toStringList();

int workerCount = settings.value("proxy/workers", 1).toInt();
QStringList cm_in_specs = settings.value("proxy/cm_in_specs").toStringList();
trimlist(&cm_in_specs);
QStringList cm_in_stream_specs = settings.value("proxy/cm_in_stream_specs").toStringList();
trimlist(&cm_in_stream_specs);
QStringList cm_out_specs = settings.value("proxy/cm_out_specs").toStringList();
trimlist(&cm_out_specs);
QStringList connmgr_in_specs = settings.value("proxy/connmgr_in_specs").toStringList();
trimlist(&connmgr_in_specs);
QStringList connmgr_in_stream_specs = settings.value("proxy/connmgr_in_stream_specs").toStringList();
trimlist(&connmgr_in_stream_specs);
QStringList connmgr_out_specs = settings.value("proxy/connmgr_out_specs").toStringList();
trimlist(&connmgr_out_specs);
QStringList condure_in_specs = settings.value("proxy/condure_in_specs").toStringList();
trimlist(&condure_in_specs);
cm_in_specs += condure_in_specs;
connmgr_in_specs += condure_in_specs;
QStringList condure_in_stream_specs = settings.value("proxy/condure_in_stream_specs").toStringList();
trimlist(&condure_in_stream_specs);
cm_in_stream_specs += condure_in_stream_specs;
connmgr_in_stream_specs += condure_in_stream_specs;
QStringList condure_out_specs = settings.value("proxy/condure_out_specs").toStringList();
trimlist(&condure_out_specs);
cm_out_specs += condure_out_specs;
connmgr_out_specs += condure_out_specs;
QStringList m2a_in_specs = settings.value("proxy/m2a_in_specs").toStringList();
trimlist(&m2a_in_specs);
QStringList m2a_in_stream_specs = settings.value("proxy/m2a_in_stream_specs").toStringList();
trimlist(&m2a_in_stream_specs);
QStringList m2a_out_specs = settings.value("proxy/m2a_out_specs").toStringList();
trimlist(&m2a_out_specs);
QStringList cm_client_out_specs = settings.value("proxy/cm_client_out_specs").toStringList();
trimlist(&cm_client_out_specs);
QStringList cm_client_out_stream_specs = settings.value("proxy/cm_client_out_stream_specs").toStringList();
trimlist(&cm_client_out_stream_specs);
QStringList cm_client_in_specs = settings.value("proxy/cm_client_in_specs").toStringList();
trimlist(&cm_client_in_specs);
QStringList connmgr_client_out_specs = settings.value("proxy/connmgr_client_out_specs").toStringList();
trimlist(&connmgr_client_out_specs);
QStringList connmgr_client_out_stream_specs = settings.value("proxy/connmgr_client_out_stream_specs").toStringList();
trimlist(&connmgr_client_out_stream_specs);
QStringList connmgr_client_in_specs = settings.value("proxy/connmgr_client_in_specs").toStringList();
trimlist(&connmgr_client_in_specs);
QStringList condure_client_out_specs = settings.value("proxy/condure_client_out_specs").toStringList();
trimlist(&condure_client_out_specs);
cm_client_out_specs += condure_client_out_specs;
connmgr_client_out_specs += condure_client_out_specs;
QStringList condure_client_out_stream_specs = settings.value("proxy/condure_client_out_stream_specs").toStringList();
trimlist(&condure_client_out_stream_specs);
cm_client_out_stream_specs += condure_client_out_stream_specs;
connmgr_client_out_stream_specs += condure_client_out_stream_specs;
QStringList condure_client_in_specs = settings.value("proxy/condure_client_in_specs").toStringList();
trimlist(&condure_client_in_specs);
cm_client_in_specs += condure_client_in_specs;
connmgr_client_in_specs += condure_client_in_specs;
QStringList zurl_out_specs = settings.value("proxy/zurl_out_specs").toStringList();
trimlist(&zurl_out_specs);
QStringList zurl_out_stream_specs = settings.value("proxy/zurl_out_stream_specs").toStringList();
Expand Down Expand Up @@ -523,16 +523,16 @@ class App::Private : public QObject
if(fi.isRelative())
routesFile = QFileInfo(configDir, routesFile).filePath();

if(!(!cm_in_specs.isEmpty() && !cm_in_stream_specs.isEmpty() && !cm_out_specs.isEmpty()) && !(!m2a_in_specs.isEmpty() && !m2a_in_stream_specs.isEmpty() && !m2a_out_specs.isEmpty()))
if(!(!connmgr_in_specs.isEmpty() && !connmgr_in_stream_specs.isEmpty() && !connmgr_out_specs.isEmpty()) && !(!m2a_in_specs.isEmpty() && !m2a_in_stream_specs.isEmpty() && !m2a_out_specs.isEmpty()))
{
log_error("must set cm_in_specs, cm_in_stream_specs, and cm_out_specs, or m2a_in_specs, m2a_in_stream_specs, and m2a_out_specs");
log_error("must set connmgr_in_specs, connmgr_in_stream_specs, and connmgr_out_specs, or m2a_in_specs, m2a_in_stream_specs, and m2a_out_specs");
q->quit(0);
return;
}

if(!(!cm_client_out_specs.isEmpty() && !cm_client_out_stream_specs.isEmpty() && !cm_client_in_specs.isEmpty()) && !(!zurl_out_specs.isEmpty() && !zurl_out_stream_specs.isEmpty() && !zurl_in_specs.isEmpty()))
if(!(!connmgr_client_out_specs.isEmpty() && !connmgr_client_out_stream_specs.isEmpty() && !connmgr_client_in_specs.isEmpty()) && !(!zurl_out_specs.isEmpty() && !zurl_out_stream_specs.isEmpty() && !zurl_in_specs.isEmpty()))
{
log_error("must set cm_client_out_specs, cm_client_out_stream_specs, and cm_client_in_specs, or zurl_out_specs, zurl_out_stream_specs, and zurl_in_specs");
log_error("must set connmgr_client_out_specs, connmgr_client_out_stream_specs, and connmgr_client_in_specs, or zurl_out_specs, zurl_out_stream_specs, and zurl_in_specs");
q->quit(0);
return;
}
Expand Down Expand Up @@ -560,23 +560,23 @@ class App::Private : public QObject
Engine::Configuration config;
config.appVersion = Config::get().version;
config.clientId = "pushpin-proxy_" + QByteArray::number(QCoreApplication::applicationPid());
if(!services.contains("mongrel2") && (!cm_in_specs.isEmpty() || !cm_in_stream_specs.isEmpty() || !cm_out_specs.isEmpty()))
if(!services.contains("mongrel2") && (!connmgr_in_specs.isEmpty() || !connmgr_in_stream_specs.isEmpty() || !connmgr_out_specs.isEmpty()))
{
config.serverInSpecs = cm_in_specs;
config.serverInStreamSpecs = cm_in_stream_specs;
config.serverOutSpecs = cm_out_specs;
config.serverInSpecs = connmgr_in_specs;
config.serverInStreamSpecs = connmgr_in_stream_specs;
config.serverOutSpecs = connmgr_out_specs;
}
else
{
config.serverInSpecs = m2a_in_specs;
config.serverInStreamSpecs = m2a_in_stream_specs;
config.serverOutSpecs = m2a_out_specs;
}
if(!services.contains("zurl") && (!cm_client_out_specs.isEmpty() || !cm_client_out_stream_specs.isEmpty() || !cm_client_in_specs.isEmpty()))
if(!services.contains("zurl") && (!connmgr_client_out_specs.isEmpty() || !connmgr_client_out_stream_specs.isEmpty() || !connmgr_client_in_specs.isEmpty()))
{
config.clientOutSpecs = cm_client_out_specs;
config.clientOutStreamSpecs = cm_client_out_stream_specs;
config.clientInSpecs = cm_client_in_specs;
config.clientOutSpecs = connmgr_client_out_specs;
config.clientOutStreamSpecs = connmgr_client_out_stream_specs;
config.clientInSpecs = connmgr_client_in_specs;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* $FANOUT_END_LICENSE$
*/

#include "cmservice.h"
#include "connmgrservice.h"

#include <QDir>
#include <QVariantList>
Expand All @@ -29,7 +29,7 @@
#include "log.h"
#include "template.h"

CmService::CmService(
ConnmgrService::ConnmgrService(
const QString &name,
const QString &binFile,
const QString &runDir,
Expand Down Expand Up @@ -103,7 +103,7 @@ CmService::CmService(
}
}

args_ += "--zclient-stream=ipc://" + runDir + "/" + ipcPrefix + "cm";
args_ += "--zclient-stream=ipc://" + runDir + "/" + ipcPrefix + "connmgr";

if(usingSsl)
args_ += "--tls-identities-dir=" + certsDir;
Expand All @@ -113,7 +113,7 @@ CmService::CmService(
{
// client mode

args_ += "--zserver-stream=ipc://" + runDir + "/" + ipcPrefix + "cm-client";
args_ += "--zserver-stream=ipc://" + runDir + "/" + ipcPrefix + "connmgr-client";

args_ += "--deny-out-internal";
}
Expand All @@ -122,33 +122,33 @@ CmService::CmService(
setPidFile(QDir(runDir).filePath(filePrefix + name + ".pid"));
}

QStringList CmService::arguments() const
QStringList ConnmgrService::arguments() const
{
return args_;
}

bool CmService::hasClientMode(const QString &binFile)
bool ConnmgrService::hasClientMode(const QString &binFile)
{
QProcess proc;

proc.start(binFile, QStringList() << "--help");

if(!proc.waitForFinished(-1))
{
log_error("Failed to run cm: process error: %d", proc.error());
log_error("Failed to run connmgr: process error: %d", proc.error());
return false;
}

if(proc.exitStatus() != QProcess::NormalExit)
{
log_error("Failed to run cm: process did not exit normally");
log_error("Failed to run connmgr: process did not exit normally");
return false;
}

int code = proc.exitCode();
if(proc.exitCode() != 0)
{
log_error("cm returned non-zero status: %d", code);
log_error("connmgr returned non-zero status: %d", code);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
* $FANOUT_END_LICENSE$
*/

#ifndef CMSERVICE_H
#define CMSERVICE_H
#ifndef CONNMGRSERVICE_H
#define CONNMGRSERVICE_H

#include "service.h"
#include "listenport.h"

class CmService : public Service
class ConnmgrService : public Service
{
public:
CmService(
ConnmgrService(
const QString &name,
const QString &binFile,
const QString &runDir,
Expand Down
Loading

0 comments on commit 7ad3722

Please sign in to comment.