summaryrefslogtreecommitdiff
path: root/src/WebSocketSessionMan.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-03-26 17:12:52 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-03-26 17:20:27 +0900
commitd64089632e82a2548752c7a6baaa68365a795a74 (patch)
tree57fc7b85a8c1290975d58fa4761b04a7695bf7e3 /src/WebSocketSessionMan.cc
parentc81b1321122e8509b55c94c0cbca0d8d6d319f0c (diff)
parenta7cd943a06b1a5ff4515b57060b84037f8d01f9f (diff)
Merge branch 'master' into random-webseeding
Diffstat (limited to 'src/WebSocketSessionMan.cc')
-rw-r--r--src/WebSocketSessionMan.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/WebSocketSessionMan.cc b/src/WebSocketSessionMan.cc
index ee9dfabd..75542e67 100644
--- a/src/WebSocketSessionMan.cc
+++ b/src/WebSocketSessionMan.cc
@@ -51,22 +51,22 @@ WebSocketSessionMan::WebSocketSessionMan() {}
WebSocketSessionMan::~WebSocketSessionMan() {}
-void WebSocketSessionMan::addSession
-(const std::shared_ptr<WebSocketSession>& wsSession)
+void WebSocketSessionMan::addSession(
+ const std::shared_ptr<WebSocketSession>& wsSession)
{
A2_LOG_DEBUG("WebSocket session added.");
sessions_.insert(wsSession);
}
-void WebSocketSessionMan::removeSession
-(const std::shared_ptr<WebSocketSession>& wsSession)
+void WebSocketSessionMan::removeSession(
+ const std::shared_ptr<WebSocketSession>& wsSession)
{
A2_LOG_DEBUG("WebSocket session removed.");
sessions_.erase(wsSession);
}
-void WebSocketSessionMan::addNotification
-(const std::string& method, const RequestGroup* group)
+void WebSocketSessionMan::addNotification(const std::string& method,
+ const RequestGroup* group)
{
auto dict = Dict::g();
dict->put("jsonrpc", "2.0");
@@ -77,13 +77,12 @@ void WebSocketSessionMan::addNotification
params->append(std::move(eventSpec));
dict->put("params", std::move(params));
std::string msg = json::encode(dict.get());
- for(auto& session : sessions_) {
+ for (auto& session : sessions_) {
session->addTextMessage(msg, false);
session->getCommand()->updateWriteCheck();
}
}
-
namespace {
// The string constants for download events.
const std::string ON_DOWNLOAD_START = "aria2.onDownloadStart";
@@ -97,7 +96,7 @@ const std::string ON_BT_DOWNLOAD_COMPLETE = "aria2.onBtDownloadComplete";
namespace {
const std::string& getMethodName(DownloadEvent event)
{
- switch(event) {
+ switch (event) {
case EVENT_ON_DOWNLOAD_START:
return ON_DOWNLOAD_START;
case EVENT_ON_DOWNLOAD_PAUSE: