11#include < algorithm>
2- #include < boost/asio/error.hpp>
3- #include < boost/asio/ip/address.hpp>
4- #include < boost/asio/socket_base.hpp>
5- #include < boost/beast/core/error.hpp>
6- #include < boost/beast/core/flat_buffer.hpp>
7- #include < boost/beast/http/field.hpp>
8- #include < boost/beast/http/impl/read.hpp>
9- #include < boost/beast/http/message_fwd.hpp>
10- #include < boost/beast/http/status.hpp>
11- #include < boost/beast/http/string_body_fwd.hpp>
12- #include < boost/beast/http/verb.hpp>
13- #include < boost/json/array.hpp>
14- #include < boost/json/object.hpp>
152#include < csignal>
163#include < cstdlib>
174#include < exception>
3118
3219// Boost
3320#include < boost/asio/dispatch.hpp>
21+ #include < boost/asio/error.hpp>
3422#include < boost/asio/executor_work_guard.hpp>
3523#include < boost/asio/io_context.hpp>
24+ #include < boost/asio/ip/address.hpp>
3625#include < boost/asio/ip/tcp.hpp>
3726#include < boost/asio/signal_set.hpp>
27+ #include < boost/asio/socket_base.hpp>
28+ #include < boost/beast/core/error.hpp>
29+ #include < boost/beast/core/flat_buffer.hpp>
30+ #include < boost/beast/http/field.hpp>
31+ #include < boost/beast/http/impl/read.hpp>
32+ #include < boost/beast/http/message_fwd.hpp>
33+ #include < boost/beast/http/status.hpp>
34+ #include < boost/beast/http/string_body_fwd.hpp>
35+ #include < boost/beast/http/verb.hpp>
3836#include < boost/beast/version.hpp>
37+ #include < boost/json/array.hpp>
38+ #include < boost/json/object.hpp>
3939#include < boost/json/parse.hpp>
4040#include < boost/json/serialize.hpp>
4141#include < boost/json/value.hpp>
@@ -146,7 +146,7 @@ struct SumomoConfig {
146146 return {3840 , 2160 };
147147 }
148148
149- // 数字で指定した場合の処理 (例 640x480 )
149+ // 数字で指定した場合の処理 (例 640x480)
150150 auto pos = resolution.find (' x' );
151151 if (pos == std::string::npos) {
152152 // TODO: 無効な形式の場合、16x16 を返すよりエラーを投げるべきか検討
@@ -167,9 +167,10 @@ using tcp = net::ip::tcp;
167167class Sumomo ;
168168
169169// HTTP リクエストを処理するセッション
170- // 注意: 現在は1リクエスト=1コネクションの設計
171- // Keep-Alive に対応する場合は、DoRead() の再帰呼び出しと
172- // リクエスト数/タイムアウトの制限を実装する必要がある
170+ //
171+ // 現在は1リクエスト=1コネクションの設計。
172+ // Keep-Alive に対応する場合、リクエストを処理し終わった後に
173+ // 再度 DoRead() を呼ぶ必要がある。
173174class HttpSession : public std ::enable_shared_from_this<HttpSession> {
174175 public:
175176 HttpSession (tcp::socket socket, std::weak_ptr<Sumomo> sumomo)
@@ -472,9 +473,7 @@ class Sumomo : public std::enable_shared_from_this<Sumomo>,
472473 void OnDisconnect (sora::SoraSignalingErrorCode ec,
473474 std::string message) override {
474475 RTC_LOG (LS_INFO ) << " OnDisconnect: " << message;
475- if (http_listener_) {
476- http_listener_.reset ();
477- }
476+ http_listener_.reset ();
478477 sdl_renderer_.reset ();
479478 sixel_renderer_.reset ();
480479 ansi_renderer_.reset ();
@@ -704,7 +703,7 @@ int main(int argc, char* argv[]) {
704703 app.add_option (" --sixel-width" , config.sixel_width , " Sixel output width" );
705704 app.add_option (" --sixel-height" , config.sixel_height , " Sixel output height" );
706705
707- // ANSI に関するオプション
706+ // ANSI エスケープシーケンスに関するオプション
708707 app.add_flag (" --use-ansi" , config.use_ansi ,
709708 " Show video using ANSI escape sequences" );
710709 app.add_option (" --ansi-width" , config.ansi_width ,
@@ -723,7 +722,7 @@ int main(int argc, char* argv[]) {
723722
724723 // HTTP サーバーに関するオプション
725724 app.add_option (" --http-port" , config.http_port ,
726- " HTTP server port for stats API (1024-65535) " )
725+ " HTTP server port for stats API" )
727726 ->check (CLI::Range (1024 , 65535 ));
728727 app.add_option (" --http-host" , config.http_host ,
729728 " HTTP server host address (default: 127.0.0.1)" );
0 commit comments