File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed
Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ using namespace asio::ip;
1616
1717int main (int argc, char ** argv)
1818{
19- auto ioc = std::make_shared<asio::io_context>( 1 );
19+ auto & ioc = LanguageClient::GetInstance (). GetIOContext ( );
2020 if (argc > 1 )
2121 {
2222 int port = std::stoi (argv[1 ]);
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ LanguageClient& LanguageClient::GetInstance()
2121LanguageClient::LanguageClient ()
2222 : _defaultOptions(std::make_shared<LuaCodeStyleOptions>()),
2323 _idCounter(0 ),
24- _ioc(nullptr )
24+ _ioc(1 )
2525{
2626}
2727
@@ -203,12 +203,11 @@ std::shared_ptr<LuaParser> LanguageClient::GetFileParser(std::string_view uri)
203203 return nullptr ;
204204}
205205
206- int LanguageClient::Run (std::shared_ptr<asio::io_context> ioc )
206+ int LanguageClient::Run ()
207207{
208- _ioc = ioc;
209208 if (_session)
210209 {
211- int ret = _session->Run (*ioc );
210+ int ret = _session->Run (_ioc );
212211 _session = nullptr ;
213212 return ret;
214213 }
@@ -309,7 +308,7 @@ void LanguageClient::SetRoot(std::string_view root)
309308
310309asio::io_context& LanguageClient::GetIOContext ()
311310{
312- return * _ioc;
311+ return _ioc;
313312}
314313
315314uint64_t LanguageClient::GetRequestId ()
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ class LanguageClient : public std::enable_shared_from_this<LanguageClient>
5050
5151 std::shared_ptr<LuaParser> GetFileParser (std::string_view uri);
5252
53- int Run (std::shared_ptr<asio::io_context> ioc );
53+ int Run ();
5454
5555 std::shared_ptr<LuaCodeStyleOptions> GetOptions (std::string_view uriOrFilename);
5656
@@ -88,7 +88,7 @@ class LanguageClient : public std::enable_shared_from_this<LanguageClient>
8888
8989 std::string _root;
9090
91- std::shared_ptr< asio::io_context> _ioc;
91+ asio::io_context _ioc;
9292
9393 std::array<std::shared_ptr<Service>, static_cast <std::size_t >(ServiceType::ServiceCount)> _services;
9494};
You can’t perform that action at this time.
0 commit comments