@@ -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,
97
+ boost::asio::yield_context yc, boost::asio::io_context::strand& strand, const Checkable::Ptr & checkable, const Array::Ptr & cmdLine,
98
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
99
+ const AsioTlsStream:: Ptr & conn, boost::beast::http::request<boost::beast::http::string_body>& req, double start
100
100
)
101
101
{
102
102
namespace http = boost::beast::http;
@@ -105,7 +105,7 @@ static void DoIfwNetIo(
105
105
http::response<http::string_body> resp;
106
106
107
107
try {
108
- Connect (conn. lowest_layer (), psHost, psPort, yc);
108
+ Connect (conn-> lowest_layer (), psHost, psPort, yc);
109
109
} catch (const std::exception & ex) {
110
110
ReportIfwCheckResult (
111
111
yc, checkable, cmdLine, cr,
@@ -115,10 +115,10 @@ static void DoIfwNetIo(
115
115
return ;
116
116
}
117
117
118
- auto & sslConn (conn. next_layer ());
118
+ auto & sslConn (conn-> next_layer ());
119
119
120
120
try {
121
- sslConn.async_handshake (conn. next_layer ().client , yc);
121
+ sslConn.async_handshake (conn-> next_layer ().client , yc);
122
122
} catch (const std::exception & ex) {
123
123
ReportIfwCheckResult (
124
124
yc, checkable, cmdLine, cr,
@@ -148,8 +148,8 @@ static void DoIfwNetIo(
148
148
}
149
149
150
150
try {
151
- http::async_write (conn, req, yc);
152
- conn. async_flush (yc);
151
+ http::async_write (* conn, req, yc);
152
+ conn-> async_flush (yc);
153
153
} catch (const std::exception & ex) {
154
154
ReportIfwCheckResult (
155
155
yc, checkable, cmdLine, cr,
@@ -160,7 +160,7 @@ static void DoIfwNetIo(
160
160
}
161
161
162
162
try {
163
- http::async_read (conn, buf, resp, yc);
163
+ http::async_read (* conn, buf, resp, yc);
164
164
} catch (const std::exception & ex) {
165
165
ReportIfwCheckResult (
166
166
yc, checkable, cmdLine, cr,
@@ -172,10 +172,7 @@ static void DoIfwNetIo(
172
172
173
173
double end = Utility::GetTime ();
174
174
175
- {
176
- boost::system ::error_code ec;
177
- sslConn.async_shutdown (yc[ec]);
178
- }
175
+ conn->GracefulDisconnect (strand, yc);
179
176
180
177
CpuBoundWork cbw (yc);
181
178
Value jsonRoot;
@@ -525,7 +522,7 @@ void IfwApiCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
525
522
526
523
Defer cancelTimeout ([&timeout]() { timeout->Cancel (); });
527
524
528
- DoIfwNetIo (yc, checkable, cmdLine, cr, psCommand, psHost, expectedSan, psPort, * conn, *req, start);
525
+ DoIfwNetIo (yc, *strand, checkable, cmdLine, cr, psCommand, psHost, expectedSan, psPort, conn, *req, start);
529
526
}
530
527
);
531
528
}
0 commit comments