本文整理汇总了C++中MessageChannel::writeScalar方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageChannel::writeScalar方法的具体用法?C++ MessageChannel::writeScalar怎么用?C++ MessageChannel::writeScalar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageChannel
的用法示例。
在下文中一共展示了MessageChannel::writeScalar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}