@@ -72,12 +72,12 @@ static void ReportIfwCheckResult(
7272}
7373
7474static void ReportIfwCheckResult (
75- boost::asio::yield_context yc, const Checkable::Ptr& checkable , const Value& cmdLine ,
76- const CheckResult::Ptr& cr, const String& output, double start
75+ boost::asio::yield_context yc, boost::asio::io_context::strand& strand , const Checkable::Ptr& checkable ,
76+ const Value& cmdLine, const CheckResult::Ptr& cr, const String& output, double start
7777)
7878{
7979 double end = Utility::GetTime ();
80- CpuBoundWork cbw (yc);
80+ CpuBoundWork cbw (yc, strand );
8181
8282 ReportIfwCheckResult (checkable, cmdLine, cr, output, start, end);
8383}
@@ -94,9 +94,9 @@ static const char* GetUnderstandableError(const std::exception& ex)
9494}
9595
9696static void DoIfwNetIo (
97- boost::asio::yield_context yc, const Checkable::Ptr& checkable , const Array ::Ptr& cmdLine ,
98- const CheckResult ::Ptr& cr , const String& psCommand , const String& psHost , const String& san , const String& psPort ,
99- AsioTlsStream& conn, boost::beast::http::request<boost::beast::http::string_body>& req, double start
97+ boost::asio::yield_context yc, boost::asio::io_context::strand& strand , const Checkable ::Ptr& checkable ,
98+ const Array ::Ptr& cmdLine , const CheckResult::Ptr& cr , const String& psCommand , const String& psHost , const String& san ,
99+ const String& psPort, AsioTlsStream& conn, boost::beast::http::request<boost::beast::http::string_body>& req, double start
100100)
101101{
102102 namespace http = boost::beast::http;
@@ -108,7 +108,7 @@ static void DoIfwNetIo(
108108 Connect (conn.lowest_layer (), psHost, psPort, yc);
109109 } catch (const std::exception& ex) {
110110 ReportIfwCheckResult (
111- yc, checkable, cmdLine, cr,
111+ yc, strand, checkable, cmdLine, cr,
112112 " Can't connect to IfW API on host '" + psHost + " ' port '" + psPort + " ': " + GetUnderstandableError (ex),
113113 start
114114 );
@@ -121,7 +121,7 @@ static void DoIfwNetIo(
121121 sslConn.async_handshake (conn.next_layer ().client , yc);
122122 } catch (const std::exception& ex) {
123123 ReportIfwCheckResult (
124- yc, checkable, cmdLine, cr,
124+ yc, strand, checkable, cmdLine, cr,
125125 " TLS handshake with IfW API on host '" + psHost + " ' (SNI: '" + san
126126 + " ') port '" + psPort + " ' failed: " + GetUnderstandableError (ex),
127127 start
@@ -139,7 +139,7 @@ static void DoIfwNetIo(
139139 }
140140
141141 ReportIfwCheckResult (
142- yc, checkable, cmdLine, cr,
142+ yc, strand, checkable, cmdLine, cr,
143143 " Certificate validation failed for IfW API on host '" + psHost + " ' (SNI: '" + san + " '; CN: "
144144 + (cn.IsString () ? " '" + cn + " '" : " N/A" ) + " ) port '" + psPort + " ': " + sslConn.GetVerifyError (),
145145 start
@@ -152,7 +152,7 @@ static void DoIfwNetIo(
152152 conn.async_flush (yc);
153153 } catch (const std::exception& ex) {
154154 ReportIfwCheckResult (
155- yc, checkable, cmdLine, cr,
155+ yc, strand, checkable, cmdLine, cr,
156156 " Can't send HTTP request to IfW API on host '" + psHost + " ' port '" + psPort + " ': " + GetUnderstandableError (ex),
157157 start
158158 );
@@ -163,7 +163,7 @@ static void DoIfwNetIo(
163163 http::async_read (conn, buf, resp, yc);
164164 } catch (const std::exception& ex) {
165165 ReportIfwCheckResult (
166- yc, checkable, cmdLine, cr,
166+ yc, strand, checkable, cmdLine, cr,
167167 " Can't read HTTP response from IfW API on host '" + psHost + " ' port '" + psPort + " ': " + GetUnderstandableError (ex),
168168 start
169169 );
@@ -177,7 +177,7 @@ static void DoIfwNetIo(
177177 sslConn.async_shutdown (yc[ec]);
178178 }
179179
180- CpuBoundWork cbw (yc);
180+ CpuBoundWork cbw (yc, strand );
181181 Value jsonRoot;
182182
183183 try {
@@ -525,7 +525,7 @@ void IfwApiCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
525525
526526 Defer cancelTimeout ([&timeout]() { timeout->Cancel (); });
527527
528- DoIfwNetIo (yc, checkable, cmdLine, cr, psCommand, psHost, expectedSan, psPort, *conn, *req, start);
528+ DoIfwNetIo (yc, *strand, checkable, cmdLine, cr, psCommand, psHost, expectedSan, psPort, *conn, *req, start);
529529 }
530530 );
531531}
0 commit comments