@@ -72,12 +72,12 @@ static void ReportIfwCheckResult(
72
72
}
73
73
74
74
static 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
77
77
)
78
78
{
79
79
double end = Utility::GetTime ();
80
- CpuBoundWork cbw (yc);
80
+ CpuBoundWork cbw (yc, strand );
81
81
82
82
ReportIfwCheckResult (checkable, cmdLine, cr, output, start, end);
83
83
}
@@ -94,9 +94,9 @@ static const char* GetUnderstandableError(const std::exception& ex)
94
94
}
95
95
96
96
static 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
100
100
)
101
101
{
102
102
namespace http = boost::beast::http;
@@ -108,7 +108,7 @@ static void DoIfwNetIo(
108
108
Connect (conn.lowest_layer (), psHost, psPort, yc);
109
109
} catch (const std::exception & ex) {
110
110
ReportIfwCheckResult (
111
- yc, checkable, cmdLine, cr,
111
+ yc, strand, checkable, cmdLine, cr,
112
112
" Can't connect to IfW API on host '" + psHost + " ' port '" + psPort + " ': " + GetUnderstandableError (ex),
113
113
start
114
114
);
@@ -121,7 +121,7 @@ static void DoIfwNetIo(
121
121
sslConn.async_handshake (conn.next_layer ().client , yc);
122
122
} catch (const std::exception & ex) {
123
123
ReportIfwCheckResult (
124
- yc, checkable, cmdLine, cr,
124
+ yc, strand, checkable, cmdLine, cr,
125
125
" TLS handshake with IfW API on host '" + psHost + " ' (SNI: '" + san
126
126
+ " ') port '" + psPort + " ' failed: " + GetUnderstandableError (ex),
127
127
start
@@ -139,7 +139,7 @@ static void DoIfwNetIo(
139
139
}
140
140
141
141
ReportIfwCheckResult (
142
- yc, checkable, cmdLine, cr,
142
+ yc, strand, checkable, cmdLine, cr,
143
143
" Certificate validation failed for IfW API on host '" + psHost + " ' (SNI: '" + san + " '; CN: "
144
144
+ (cn.IsString () ? " '" + cn + " '" : " N/A" ) + " ) port '" + psPort + " ': " + sslConn.GetVerifyError (),
145
145
start
@@ -152,7 +152,7 @@ static void DoIfwNetIo(
152
152
conn.async_flush (yc);
153
153
} catch (const std::exception & ex) {
154
154
ReportIfwCheckResult (
155
- yc, checkable, cmdLine, cr,
155
+ yc, strand, checkable, cmdLine, cr,
156
156
" Can't send HTTP request to IfW API on host '" + psHost + " ' port '" + psPort + " ': " + GetUnderstandableError (ex),
157
157
start
158
158
);
@@ -163,7 +163,7 @@ static void DoIfwNetIo(
163
163
http::async_read (conn, buf, resp, yc);
164
164
} catch (const std::exception & ex) {
165
165
ReportIfwCheckResult (
166
- yc, checkable, cmdLine, cr,
166
+ yc, strand, checkable, cmdLine, cr,
167
167
" Can't read HTTP response from IfW API on host '" + psHost + " ' port '" + psPort + " ': " + GetUnderstandableError (ex),
168
168
start
169
169
);
@@ -177,7 +177,7 @@ static void DoIfwNetIo(
177
177
sslConn.async_shutdown (yc[ec]);
178
178
}
179
179
180
- CpuBoundWork cbw (yc);
180
+ CpuBoundWork cbw (yc, strand );
181
181
Value jsonRoot;
182
182
183
183
try {
@@ -525,7 +525,7 @@ void IfwApiCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
525
525
526
526
Defer cancelTimeout ([&timeout]() { timeout->Cancel (); });
527
527
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);
529
529
}
530
530
);
531
531
}
0 commit comments