本文整理汇总了C++中MessageChannel::write方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageChannel::write方法的具体用法?C++ MessageChannel::write怎么用?C++ MessageChannel::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageChannel
的用法示例。
在下文中一共展示了MessageChannel::write方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processGet
void processGet(const vector<string> &args) {
TRACE_POINT();
Application::SessionPtr session;
bool failed = false;
try {
session = server.pool.get(SpawnOptions(
args[1], args[2] == "true", args[3],
args[4], args[5], args[6],
atoi(args[7]), atoi(args[8])));
sessions[lastSessionID] = session;
lastSessionID++;
} catch (const SpawnException &e) {
UPDATE_TRACE_POINT();
this_thread::disable_syscall_interruption dsi;
if (e.hasErrorPage()) {
P_TRACE(3, "Client " << this << ": SpawnException "
"occured (with error page)");
channel.write("SpawnException", e.what(), "true", NULL);
channel.writeScalar(e.getErrorPage());
} else {
P_TRACE(3, "Client " << this << ": SpawnException "
"occured (no error page)");
channel.write("SpawnException", e.what(), "false", NULL);
}
failed = true;
} catch (const BusyException &e) {
UPDATE_TRACE_POINT();
this_thread::disable_syscall_interruption dsi;
channel.write("BusyException", e.what(), NULL);
failed = true;
} catch (const IOException &e) {
UPDATE_TRACE_POINT();
this_thread::disable_syscall_interruption dsi;
channel.write("IOException", e.what(), NULL);
failed = true;
}
UPDATE_TRACE_POINT();
if (!failed) {
this_thread::disable_syscall_interruption dsi;
try {
UPDATE_TRACE_POINT();
channel.write("ok", toString(session->getPid()).c_str(),
toString(lastSessionID - 1).c_str(), NULL);
channel.writeFileDescriptor(session->getStream());
session->closeStream();
} catch (const exception &) {
UPDATE_TRACE_POINT();
P_TRACE(3, "Client " << this << ": something went wrong "
"while sending 'ok' back to the client.");
sessions.erase(lastSessionID - 1);
throw;
}
}
}
示例2: sendStartupInfo
virtual void sendStartupInfo(MessageChannel &channel) {
channel.write("HelperAgent info",
requestSocketFilename.c_str(),
Base64::encode(requestSocketPassword).c_str(),
messageSocketFilename.c_str(),
Base64::encode(messageSocketPassword).c_str(),
NULL);
}
示例3: processGetSpawnServerPid
void processGetSpawnServerPid(const vector<string> &args) {
TRACE_POINT();
channel.write(toString(server.pool->getSpawnServerPid()).c_str(), NULL);
}
示例4: processGetCount
void processGetCount(const vector<string> &args) {
TRACE_POINT();
channel.write(toString(server.pool.getCount()).c_str(), NULL);
}
示例5: processGetSpawnServerPid
void processGetSpawnServerPid(const vector<string> &args) {
channel.write(toString(server.pool.getSpawnServerPid()).c_str(), NULL);
}
示例6: processGetActive
void processGetActive(const vector<string> &args) {
channel.write(toString(server.pool.getActive()).c_str(), NULL);
}
示例7: serverInstanceDir
Server(FileDescriptor feedbackFd,
pid_t webServerPid, const string &tempDir,
bool userSwitching, const string &defaultUser, const string &defaultGroup,
const string &passengerRoot, const string &rubyCommand,
unsigned int generationNumber, unsigned int maxPoolSize,
unsigned int maxInstancesPerApp, unsigned int poolIdleTime,
const VariantMap &options)
: serverInstanceDir(webServerPid, tempDir, false),
resourceLocator(passengerRoot)
{
TRACE_POINT();
string messageSocketPassword;
string loggingAgentPassword;
this->feedbackFd = feedbackFd;
feedbackChannel = MessageChannel(feedbackFd);
UPDATE_TRACE_POINT();
messageSocketPassword = Base64::decode(options.get("message_socket_password"));
loggingAgentPassword = options.get("logging_agent_password");
generation = serverInstanceDir.getGeneration(generationNumber);
accountsDatabase = AccountsDatabase::createDefault(generation,
userSwitching, defaultUser, defaultGroup);
accountsDatabase->add("_web_server", messageSocketPassword, false,
Account::GET | Account::DETACH | Account::SET_PARAMETERS | Account::EXIT);
messageServer = ptr(new MessageServer(generation->getPath() + "/socket", accountsDatabase));
createFile(generation->getPath() + "/helper_server.pid",
toString(getpid()), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (geteuid() == 0 && !userSwitching) {
lowerPrivilege(defaultUser, defaultGroup);
}
UPDATE_TRACE_POINT();
analyticsLogger = ptr(new AnalyticsLogger(options.get("logging_agent_address"),
"logging", loggingAgentPassword));
pool = ptr(new ApplicationPool::Pool(
resourceLocator.getSpawnServerFilename(), generation,
accountsDatabase, rubyCommand,
analyticsLogger,
options.getInt("log_level"),
options.get("debug_log_file", false)
));
pool->setMax(maxPoolSize);
pool->setMaxPerApp(maxInstancesPerApp);
pool->setMaxIdleTime(poolIdleTime);
messageServer->addHandler(ptr(new TimerUpdateHandler(exitTimer)));
messageServer->addHandler(ptr(new ApplicationPool::Server(pool)));
messageServer->addHandler(ptr(new BacktracesServer()));
messageServer->addHandler(ptr(new ExitHandler(exitEvent)));
UPDATE_TRACE_POINT();
feedbackChannel.write("initialized",
"", // Request socket filename; not available in the Apache helper server.
messageServer->getSocketFilename().c_str(),
NULL);
prestarterThread = ptr(new oxt::thread(
boost::bind(prestartWebApps, resourceLocator, options.get("prestart_urls"))
));
}