Title: 为啥不提供异步接口 · Issue #26 · sprinfall/webcc · GitHub
Open Graph Title: 为啥不提供异步接口 · Issue #26 · sprinfall/webcc
X Title: 为啥不提供异步接口 · Issue #26 · sprinfall/webcc
Description: 我看了您的部分代码(主要是关于http client部分的),发现其本身就是支持异步调用的。 void ClientBase::AsyncResolve(string_view default_port) { std::string port = request_->port(); if (port.empty()) { port = ToString(default_port); } LOG_VERB("Resolve host (%s)", request_->ho...
Open Graph Description: 我看了您的部分代码(主要是关于http client部分的),发现其本身就是支持异步调用的。 void ClientBase::AsyncResolve(string_view default_port) { std::string port = request_->port(); if (port.empty()) { port = ToString(default_port); } LO...
X Description: 我看了您的部分代码(主要是关于http client部分的),发现其本身就是支持异步调用的。 void ClientBase::AsyncResolve(string_view default_port) { std::string port = request_->port(); if (port.empty()) { port = ToString(default_port); }...
Opengraph URL: https://github.com/sprinfall/webcc/issues/26
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"为啥不提供异步接口","articleBody":"我看了您的部分代码(主要是关于http client部分的),发现其本身就是支持异步调用的。\r\n\r\n---------------------------------------------------------------------------------------\r\nvoid ClientBase::AsyncResolve(string_view default_port) {\r\n std::string port = request_-\u003eport();\r\n if (port.empty()) {\r\n port = ToString(default_port);\r\n }\r\n\r\n LOG_VERB(\"Resolve host (%s)\", request_-\u003ehost().c_str());\r\n\r\n // The protocol depends on the `host`, both V4 and V6 are supported.\r\n resolver_.async_resolve(request_-\u003ehost(), port,\r\n std::bind(\u0026ClientBase::OnResolve, this, _1, _2));\r\n}\r\n\r\nvoid ClientBase::OnResolve(boost::system::error_code ec,\r\n tcp::resolver::results_type endpoints) {\r\n if (ec) {\r\n LOG_ERRO(\"Host resolve error (%s)\", ec.message().c_str());\r\n error_.Set(Error::kResolveError, \"Host resolve error\");\r\n FinishRequest();\r\n return;\r\n }\r\n\r\n LOG_VERB(\"Connect socket\");\r\n\r\n AsyncWaitDeadlineTimer(connect_timeout_);\r\n\r\n socket_-\u003eAsyncConnect(request_-\u003ehost(), endpoints,\r\n std::bind(\u0026ClientBase::OnConnect, this, _1, _2));\r\n}\r\n---------------------------------------------------------------------------------------\r\n\r\n以上代码就是异步调用的。只是在ClientBase::FinishRequest函数中强行做了一个同步。\r\n\r\n我比较好奇的是,为啥不开放异步调用接口。对整个框架其实也没有额外的负担。","author":{"url":"https://github.com/windflowerly","@type":"Person","name":"windflowerly"},"datePublished":"2021-09-29T02:51:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/26/webcc/issues/26"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b4452270-7420-1b01-9858-bcf0a99f84bf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E39A:CFFC3:23C7B1C:3391489:6A4BE1CE |
| html-safe-nonce | bbbb659496129757d2c0639106e9081f9ebd94cc4c5a8fbb03963854ef52f19d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzlBOkNGRkMzOjIzQzdCMUM6MzM5MTQ4OTo2QTRCRTFDRSIsInZpc2l0b3JfaWQiOiI1MzcxMjMxMTMwODc0NTM2Mzk4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 13f8c228b95faf741f85130116014aa04f798b4a5949d24c90af293a4ac3041c |
| hovercard-subject-tag | issue:1010421674 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sprinfall/webcc/26/issue_layout |
| twitter:image | https://opengraph.githubassets.com/06e88d76bf5a914003718cd255f29b1a90db61f5957f113ae1f173f1f588955c/sprinfall/webcc/issues/26 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/06e88d76bf5a914003718cd255f29b1a90db61f5957f113ae1f173f1f588955c/sprinfall/webcc/issues/26 |
| og:image:alt | 我看了您的部分代码(主要是关于http client部分的),发现其本身就是支持异步调用的。 void ClientBase::AsyncResolve(string_view default_port) { std::string port = request_->port(); if (port.empty()) { port = ToString(default_port); } LO... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | windflowerly |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0f5d3ba365b3985d75c32a5957c8635488d58dcf027ae6ae958eee7edaa306a2 |
| turbo-cache-control | no-preview |
| go-import | github.com/sprinfall/webcc git https://github.com/sprinfall/webcc.git |
| octolytics-dimension-user_id | 2732484 |
| octolytics-dimension-user_login | sprinfall |
| octolytics-dimension-repository_id | 92490850 |
| octolytics-dimension-repository_nwo | sprinfall/webcc |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 92490850 |
| octolytics-dimension-repository_network_root_nwo | sprinfall/webcc |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 253920ac2dc35b0849cca4633895f1f2e5f03051 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width