mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:02:45 +00:00 
			
		
		
		
	Userland: Rename IPC ClientConnection => ConnectionFromClient
This was done with CLion's automatic rename feature and with:
find . -name ClientConnection.h
    | rename 's/ClientConnection\.h/ConnectionFromClient.h/'
find . -name ClientConnection.cpp
    | rename 's/ClientConnection\.cpp/ConnectionFromClient.cpp/'
			
			
This commit is contained in:
		
							parent
							
								
									efac862570
								
							
						
					
					
						commit
						3a71748e5d
					
				
					 137 changed files with 896 additions and 896 deletions
				
			
		|  | @ -42,7 +42,7 @@ In the GUI application process, a `OutOfProcessWebView` widget is placed somewhe | |||
| 
 | ||||
| Internally, the `OutOfProcessWebView` has a `WebContentClient` object that implements the client side of the **WebContent** IPC protocol. | ||||
| 
 | ||||
| The `WebContentClient` speaks to a `WebContent::ClientConnection` in the **WebContent** process. Internally, the `WebContent::ClientConnection` has a `WebContent::PageHost` which hosts the **LibWeb** engine's main `Web::Page` object. | ||||
| The `WebContentClient` speaks to a `WebContent::ConnectionFromClient` in the **WebContent** process. Internally, the `WebContent::ConnectionFromClient` has a `WebContent::PageHost` which hosts the **LibWeb** engine's main `Web::Page` object. | ||||
| 
 | ||||
| Inside **LibWeb**, a `Web::Page` has a main `Web::Frame`, which may have subframes corresponding to `<frame>` or `<iframe>` HTML elements. Each `Web::Frame` has a `Web::Document`, which is the root node of the DOM tree. | ||||
| 
 | ||||
|  |  | |||
|  | @ -287,7 +287,7 @@ if (BUILD_LAGOM) | |||
| 
 | ||||
|     # Audio | ||||
|     file(GLOB LIBAUDIO_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibAudio/*.cpp") | ||||
|     list(REMOVE_ITEM LIBAUDIO_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibAudio/ClientConnection.cpp") | ||||
|     list(REMOVE_ITEM LIBAUDIO_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibAudio/ConnectionFromClient.cpp") | ||||
|     lagom_lib(Audio audio | ||||
|         SOURCES ${LIBAUDIO_SOURCES} | ||||
|     ) | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <AK/Array.h> | ||||
| #include <LibAudio/ClientConnection.h> | ||||
| #include <LibAudio/ConnectionFromClient.h> | ||||
| #include <LibConfig/Client.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Application.h> | ||||
|  | @ -43,14 +43,14 @@ public: | |||
|                 { 0, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/audio-volume-zero.png")) }, | ||||
|                 { 0, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/audio-volume-muted.png")) } } | ||||
|         }; | ||||
|         auto audio_client = TRY(Audio::ClientConnection::try_create()); | ||||
|         auto audio_client = TRY(Audio::ConnectionFromClient::try_create()); | ||||
|         NonnullRefPtr<AudioWidget> audio_widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) AudioWidget(move(audio_client), move(volume_level_bitmaps)))); | ||||
|         TRY(audio_widget->try_initialize_graphical_elements()); | ||||
|         return audio_widget; | ||||
|     } | ||||
| 
 | ||||
| private: | ||||
|     AudioWidget(NonnullRefPtr<Audio::ClientConnection> audio_client, Array<VolumeBitmapPair, 5> volume_level_bitmaps) | ||||
|     AudioWidget(NonnullRefPtr<Audio::ConnectionFromClient> audio_client, Array<VolumeBitmapPair, 5> volume_level_bitmaps) | ||||
|         : m_audio_client(move(audio_client)) | ||||
|         , m_volume_level_bitmaps(move(volume_level_bitmaps)) | ||||
|         , m_show_percent(Config::read_bool("AudioApplet", "Applet", "ShowPercent", false)) | ||||
|  | @ -222,7 +222,7 @@ private: | |||
|             height); | ||||
|     } | ||||
| 
 | ||||
|     NonnullRefPtr<Audio::ClientConnection> m_audio_client; | ||||
|     NonnullRefPtr<Audio::ConnectionFromClient> m_audio_client; | ||||
|     Array<VolumeBitmapPair, 5> m_volume_level_bitmaps; | ||||
|     bool m_show_percent { false }; | ||||
|     bool m_audio_muted { false }; | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ AudioPlayerLoop::AudioPlayerLoop(TrackManager& track_manager, bool& need_to_writ | |||
|     , m_need_to_write_wav(need_to_write_wav) | ||||
|     , m_wav_writer(wav_writer) | ||||
| { | ||||
|     m_audio_client = Audio::ClientConnection::try_create().release_value_but_fixme_should_propagate_errors(); | ||||
|     m_audio_client = Audio::ConnectionFromClient::try_create().release_value_but_fixme_should_propagate_errors(); | ||||
|     m_audio_client->on_finish_playing_buffer = [this](int buffer_id) { | ||||
|         (void)buffer_id; | ||||
|         enqueue_audio(); | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ | |||
| 
 | ||||
| #include "Music.h" | ||||
| #include <LibAudio/Buffer.h> | ||||
| #include <LibAudio/ClientConnection.h> | ||||
| #include <LibAudio/ConnectionFromClient.h> | ||||
| #include <LibAudio/WavWriter.h> | ||||
| #include <LibCore/Object.h> | ||||
| 
 | ||||
|  | @ -31,7 +31,7 @@ private: | |||
|     TrackManager& m_track_manager; | ||||
|     Array<Sample, sample_count> m_buffer; | ||||
|     Optional<Audio::ResampleHelper<double>> m_resampler; | ||||
|     RefPtr<Audio::ClientConnection> m_audio_client; | ||||
|     RefPtr<Audio::ConnectionFromClient> m_audio_client; | ||||
| 
 | ||||
|     bool m_should_play_audio = true; | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
| #include "TrackManager.h" | ||||
| #include <AK/Queue.h> | ||||
| #include <LibAudio/Buffer.h> | ||||
| #include <LibAudio/ClientConnection.h> | ||||
| #include <LibAudio/ConnectionFromClient.h> | ||||
| #include <LibAudio/WavWriter.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/System.h> | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| 
 | ||||
| #include "PlaybackManager.h" | ||||
| 
 | ||||
| PlaybackManager::PlaybackManager(NonnullRefPtr<Audio::ClientConnection> connection) | ||||
| PlaybackManager::PlaybackManager(NonnullRefPtr<Audio::ConnectionFromClient> connection) | ||||
|     : m_connection(connection) | ||||
| { | ||||
|     m_timer = Core::Timer::construct(PlaybackManager::update_rate_ms, [&]() { | ||||
|  |  | |||
|  | @ -10,13 +10,13 @@ | |||
| #include <AK/Queue.h> | ||||
| #include <AK/Vector.h> | ||||
| #include <LibAudio/Buffer.h> | ||||
| #include <LibAudio/ClientConnection.h> | ||||
| #include <LibAudio/ConnectionFromClient.h> | ||||
| #include <LibAudio/Loader.h> | ||||
| #include <LibCore/Timer.h> | ||||
| 
 | ||||
| class PlaybackManager final { | ||||
| public: | ||||
|     PlaybackManager(NonnullRefPtr<Audio::ClientConnection>); | ||||
|     PlaybackManager(NonnullRefPtr<Audio::ConnectionFromClient>); | ||||
|     ~PlaybackManager() = default; | ||||
| 
 | ||||
|     void play(); | ||||
|  | @ -34,7 +34,7 @@ public: | |||
|     float total_length() const { return m_total_length; } | ||||
|     RefPtr<Audio::Buffer> current_buffer() const { return m_current_buffer; } | ||||
| 
 | ||||
|     NonnullRefPtr<Audio::ClientConnection> connection() const { return m_connection; } | ||||
|     NonnullRefPtr<Audio::ConnectionFromClient> connection() const { return m_connection; } | ||||
| 
 | ||||
|     Function<void()> on_update; | ||||
|     Function<void(Audio::Buffer&)> on_load_sample_buffer; | ||||
|  | @ -55,7 +55,7 @@ private: | |||
|     size_t m_device_samples_per_buffer { 0 }; | ||||
|     size_t m_source_buffer_size_bytes { 0 }; | ||||
|     RefPtr<Audio::Loader> m_loader { nullptr }; | ||||
|     NonnullRefPtr<Audio::ClientConnection> m_connection; | ||||
|     NonnullRefPtr<Audio::ConnectionFromClient> m_connection; | ||||
|     RefPtr<Audio::Buffer> m_current_buffer; | ||||
|     Queue<i32, always_enqueued_buffer_count + 1> m_enqueued_buffers; | ||||
|     Optional<Audio::ResampleHelper<double>> m_resampler; | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| 
 | ||||
| #include "Player.h" | ||||
| 
 | ||||
| Player::Player(Audio::ClientConnection& audio_client_connection) | ||||
| Player::Player(Audio::ConnectionFromClient& audio_client_connection) | ||||
|     : m_audio_client_connection(audio_client_connection) | ||||
|     , m_playback_manager(audio_client_connection) | ||||
| { | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ public: | |||
|         Shuffling, | ||||
|     }; | ||||
| 
 | ||||
|     explicit Player(Audio::ClientConnection& audio_client_connection); | ||||
|     explicit Player(Audio::ConnectionFromClient& audio_client_connection); | ||||
|     virtual ~Player() = default; | ||||
| 
 | ||||
|     void play_file_path(String const& path); | ||||
|  | @ -90,7 +90,7 @@ private: | |||
|     LoopMode m_loop_mode; | ||||
|     ShuffleMode m_shuffle_mode; | ||||
| 
 | ||||
|     Audio::ClientConnection& m_audio_client_connection; | ||||
|     Audio::ConnectionFromClient& m_audio_client_connection; | ||||
|     PlaybackManager m_playback_manager; | ||||
| 
 | ||||
|     String m_loaded_filename; | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ | |||
| #include <LibGUI/Window.h> | ||||
| #include <LibGfx/Bitmap.h> | ||||
| 
 | ||||
| SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window, Audio::ClientConnection& connection) | ||||
| SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window, Audio::ConnectionFromClient& connection) | ||||
|     : Player(connection) | ||||
|     , m_window(window) | ||||
| { | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
| #include "Player.h" | ||||
| #include "VisualizationWidget.h" | ||||
| #include <AK/NonnullRefPtr.h> | ||||
| #include <LibAudio/ClientConnection.h> | ||||
| #include <LibAudio/ConnectionFromClient.h> | ||||
| #include <LibGUI/Splitter.h> | ||||
| #include <LibGUI/Widget.h> | ||||
| 
 | ||||
|  | @ -50,7 +50,7 @@ protected: | |||
|     void keydown_event(GUI::KeyEvent&) override; | ||||
| 
 | ||||
| private: | ||||
|     SoundPlayerWidgetAdvancedView(GUI::Window&, Audio::ClientConnection&); | ||||
|     SoundPlayerWidgetAdvancedView(GUI::Window&, Audio::ConnectionFromClient&); | ||||
| 
 | ||||
|     void sync_previous_next_buttons(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| #include "Player.h" | ||||
| #include "SampleWidget.h" | ||||
| #include "SoundPlayerWidgetAdvancedView.h" | ||||
| #include <LibAudio/ClientConnection.h> | ||||
| #include <LibAudio/ConnectionFromClient.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Action.h> | ||||
| #include <LibGUI/ActionGroup.h> | ||||
|  | @ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath thread unix")); | ||||
| 
 | ||||
|     auto app = TRY(GUI::Application::try_create(arguments)); | ||||
|     auto audio_client = TRY(Audio::ClientConnection::try_create()); | ||||
|     auto audio_client = TRY(Audio::ConnectionFromClient::try_create()); | ||||
| 
 | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath thread")); | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <LibAudio/ClientConnection.h> | ||||
| #include <LibAudio/ConnectionFromClient.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/BoxLayout.h> | ||||
| #include <LibGUI/ImageWidget.h> | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ compile_ipc(LanguageClient.ipc LanguageClientEndpoint.h) | |||
| 
 | ||||
| set(SOURCES | ||||
|         CodeComprehensionEngine.cpp | ||||
|         ClientConnection.cpp | ||||
|         ConnectionFromClient.cpp | ||||
|         FileDB.cpp) | ||||
| set(GENERATED_SOURCES | ||||
|         LanguageClientEndpoint.h | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
| 
 | ||||
| namespace LanguageServers { | ||||
| 
 | ||||
| class ClientConnection; | ||||
| class ConnectionFromClient; | ||||
| 
 | ||||
| class CodeComprehensionEngine { | ||||
| public: | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include <AK/Debug.h> | ||||
| #include <AK/HashMap.h> | ||||
| #include <LibCore/File.h> | ||||
|  | @ -13,21 +13,21 @@ | |||
| 
 | ||||
| namespace LanguageServers { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|     : IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint>(*this, move(socket), 1) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|     : IPC::ConnectionFromClient<LanguageClientEndpoint, LanguageServerEndpoint>(*this, move(socket), 1) | ||||
| { | ||||
|     s_connections.set(1, *this); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
|     exit(0); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::greet(String const& project_root) | ||||
| void ConnectionFromClient::greet(String const& project_root) | ||||
| { | ||||
|     m_filedb.set_project_root(project_root); | ||||
|     if (unveil(project_root.characters(), "r") < 0) { | ||||
|  | @ -40,7 +40,7 @@ void ClientConnection::greet(String const& project_root) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::file_opened(String const& filename, IPC::File const& file) | ||||
| void ConnectionFromClient::file_opened(String const& filename, IPC::File const& file) | ||||
| { | ||||
|     if (m_filedb.is_open(filename)) { | ||||
|         return; | ||||
|  | @ -49,7 +49,7 @@ void ClientConnection::file_opened(String const& filename, IPC::File const& file | |||
|     m_autocomplete_engine->file_opened(filename); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::file_edit_insert_text(String const& filename, String const& text, i32 start_line, i32 start_column) | ||||
| void ConnectionFromClient::file_edit_insert_text(String const& filename, String const& text, i32 start_line, i32 start_column) | ||||
| { | ||||
|     dbgln_if(LANGUAGE_SERVER_DEBUG, "InsertText for file: {}", filename); | ||||
|     dbgln_if(LANGUAGE_SERVER_DEBUG, "Text: {}", text); | ||||
|  | @ -58,7 +58,7 @@ void ClientConnection::file_edit_insert_text(String const& filename, String cons | |||
|     m_autocomplete_engine->on_edit(filename); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::file_edit_remove_text(String const& filename, i32 start_line, i32 start_column, i32 end_line, i32 end_column) | ||||
| void ConnectionFromClient::file_edit_remove_text(String const& filename, i32 start_line, i32 start_column, i32 end_line, i32 end_column) | ||||
| { | ||||
|     dbgln_if(LANGUAGE_SERVER_DEBUG, "RemoveText for file: {}", filename); | ||||
|     dbgln_if(LANGUAGE_SERVER_DEBUG, "[{}:{} - {}:{}]", start_line, start_column, end_line, end_column); | ||||
|  | @ -66,7 +66,7 @@ void ClientConnection::file_edit_remove_text(String const& filename, i32 start_l | |||
|     m_autocomplete_engine->on_edit(filename); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::auto_complete_suggestions(GUI::AutocompleteProvider::ProjectLocation const& location) | ||||
| void ConnectionFromClient::auto_complete_suggestions(GUI::AutocompleteProvider::ProjectLocation const& location) | ||||
| { | ||||
|     dbgln_if(LANGUAGE_SERVER_DEBUG, "AutoCompleteSuggestions for: {} {}:{}", location.file, location.line, location.column); | ||||
| 
 | ||||
|  | @ -81,7 +81,7 @@ void ClientConnection::auto_complete_suggestions(GUI::AutocompleteProvider::Proj | |||
|     async_auto_complete_suggestions(move(suggestions)); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::set_file_content(String const& filename, String const& content) | ||||
| void ConnectionFromClient::set_file_content(String const& filename, String const& content) | ||||
| { | ||||
|     dbgln_if(LANGUAGE_SERVER_DEBUG, "SetFileContent: {}", filename); | ||||
|     auto document = m_filedb.get(filename); | ||||
|  | @ -95,7 +95,7 @@ void ClientConnection::set_file_content(String const& filename, String const& co | |||
|     m_autocomplete_engine->on_edit(filename); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::find_declaration(GUI::AutocompleteProvider::ProjectLocation const& location) | ||||
| void ConnectionFromClient::find_declaration(GUI::AutocompleteProvider::ProjectLocation const& location) | ||||
| { | ||||
|     dbgln_if(LANGUAGE_SERVER_DEBUG, "FindDeclaration: {} {}:{}", location.file, location.line, location.column); | ||||
|     auto document = m_filedb.get(location.file); | ||||
|  | @ -115,7 +115,7 @@ void ClientConnection::find_declaration(GUI::AutocompleteProvider::ProjectLocati | |||
|     async_declaration_location(GUI::AutocompleteProvider::ProjectLocation { decl_location.value().file, decl_location.value().line, decl_location.value().column }); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::get_parameters_hint(GUI::AutocompleteProvider::ProjectLocation const& location) | ||||
| void ConnectionFromClient::get_parameters_hint(GUI::AutocompleteProvider::ProjectLocation const& location) | ||||
| { | ||||
|     dbgln_if(LANGUAGE_SERVER_DEBUG, "GetParametersHint: {} {}:{}", location.file, location.line, location.column); | ||||
|     auto document = m_filedb.get(location.file); | ||||
|  | @ -140,7 +140,7 @@ void ClientConnection::get_parameters_hint(GUI::AutocompleteProvider::ProjectLoc | |||
|     async_parameters_hint_result(params->params, params->current_index); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::get_tokens_info(String const& filename) | ||||
| void ConnectionFromClient::get_tokens_info(String const& filename) | ||||
| { | ||||
|     dbgln_if(LANGUAGE_SERVER_DEBUG, "GetTokenInfo: {}", filename); | ||||
|     auto document = m_filedb.get(filename); | ||||
|  | @ -12,17 +12,17 @@ | |||
| #include "FileDB.h" | ||||
| #include <AK/HashMap.h> | ||||
| #include <AK/LexicalPath.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| 
 | ||||
| #include <Userland/DevTools/HackStudio/LanguageServers/LanguageClientEndpoint.h> | ||||
| #include <Userland/DevTools/HackStudio/LanguageServers/LanguageServerEndpoint.h> | ||||
| 
 | ||||
| namespace LanguageServers { | ||||
| 
 | ||||
| class ClientConnection : public IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint> { | ||||
| class ConnectionFromClient : public IPC::ConnectionFromClient<LanguageClientEndpoint, LanguageServerEndpoint> { | ||||
| public: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
|     ~ClientConnection() override = default; | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
|     ~ConnectionFromClient() override = default; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
|  | @ -7,16 +7,16 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include "CppComprehensionEngine.h" | ||||
| #include <DevTools/HackStudio/LanguageServers/ClientConnection.h> | ||||
| #include <DevTools/HackStudio/LanguageServers/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace LanguageServers::Cpp { | ||||
| 
 | ||||
| class ClientConnection final : public LanguageServers::ClientConnection { | ||||
|     C_OBJECT(ClientConnection); | ||||
| class ConnectionFromClient final : public LanguageServers::ConnectionFromClient { | ||||
|     C_OBJECT(ConnectionFromClient); | ||||
| 
 | ||||
| private: | ||||
|     ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|         : LanguageServers::ClientConnection(move(socket)) | ||||
|     ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|         : LanguageServers::ConnectionFromClient(move(socket)) | ||||
|     { | ||||
|         m_autocomplete_engine = make<CppComprehensionEngine>(m_filedb); | ||||
|         m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) { | ||||
|  | @ -27,6 +27,6 @@ private: | |||
|         }; | ||||
|     } | ||||
| 
 | ||||
|     virtual ~ClientConnection() override = default; | ||||
|     virtual ~ConnectionFromClient() override = default; | ||||
| }; | ||||
| } | ||||
|  | @ -16,7 +16,7 @@ | |||
| #include <LibCpp/Parser.h> | ||||
| #include <LibCpp/Preprocessor.h> | ||||
| #include <LibRegex/Regex.h> | ||||
| #include <Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h> | ||||
| #include <Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace LanguageServers::Cpp { | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include "Tests.h" | ||||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
|  | @ -34,7 +34,7 @@ ErrorOr<int> mode_server() | |||
|     Core::EventLoop event_loop; | ||||
|     TRY(Core::System::pledge("stdio unix recvfd rpath")); | ||||
| 
 | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<LanguageServers::Cpp::ClientConnection>()); | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<LanguageServers::Cpp::ConnectionFromClient>()); | ||||
| 
 | ||||
|     TRY(Core::System::pledge("stdio recvfd rpath")); | ||||
|     TRY(Core::System::unveil("/usr/include", "r")); | ||||
|  |  | |||
|  | @ -7,17 +7,17 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include "ShellComprehensionEngine.h" | ||||
| #include <DevTools/HackStudio/LanguageServers/ClientConnection.h> | ||||
| #include <DevTools/HackStudio/LanguageServers/ConnectionFromClient.h> | ||||
| #include <LibCpp/Parser.h> | ||||
| 
 | ||||
| namespace LanguageServers::Shell { | ||||
| 
 | ||||
| class ClientConnection final : public LanguageServers::ClientConnection { | ||||
|     C_OBJECT(ClientConnection); | ||||
| class ConnectionFromClient final : public LanguageServers::ConnectionFromClient { | ||||
|     C_OBJECT(ConnectionFromClient); | ||||
| 
 | ||||
| private: | ||||
|     ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|         : LanguageServers::ClientConnection(move(socket)) | ||||
|     ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|         : LanguageServers::ConnectionFromClient(move(socket)) | ||||
|     { | ||||
|         m_autocomplete_engine = make<ShellComprehensionEngine>(m_filedb); | ||||
|         m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) { | ||||
|  | @ -27,6 +27,6 @@ private: | |||
|             async_todo_entries_in_document(filename, move(todo_entries)); | ||||
|         }; | ||||
|     } | ||||
|     virtual ~ClientConnection() override = default; | ||||
|     virtual ~ConnectionFromClient() override = default; | ||||
| }; | ||||
| } | ||||
|  | @ -8,7 +8,7 @@ | |||
| #include <AK/Assertions.h> | ||||
| #include <AK/HashTable.h> | ||||
| #include <LibRegex/Regex.h> | ||||
| #include <Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h> | ||||
| #include <Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace LanguageServers::Shell { | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibCore/System.h> | ||||
|  | @ -16,7 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
|     Core::EventLoop event_loop; | ||||
|     TRY(Core::System::pledge("stdio unix rpath recvfd")); | ||||
| 
 | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<LanguageServers::Shell::ClientConnection>()); | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<LanguageServers::Shell::ConnectionFromClient>()); | ||||
| 
 | ||||
|     TRY(Core::System::pledge("stdio rpath recvfd")); | ||||
|     TRY(Core::System::unveil("/etc/passwd", "r")); | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| set(SOURCES | ||||
|     Buffer.cpp | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     Loader.cpp | ||||
|     WavLoader.cpp | ||||
|     FlacLoader.cpp | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <LibAudio/Buffer.h> | ||||
| #include <LibAudio/ClientConnection.h> | ||||
| #include <LibAudio/ConnectionFromClient.h> | ||||
| #include <time.h> | ||||
| 
 | ||||
| namespace Audio { | ||||
|  | @ -14,12 +14,12 @@ namespace Audio { | |||
| // Real-time audio may be improved with a lower value.
 | ||||
| static timespec g_enqueue_wait_time { 0, 10'000'000 }; | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|     : IPC::ServerConnection<AudioClientEndpoint, AudioServerEndpoint>(*this, move(socket)) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::enqueue(Buffer const& buffer) | ||||
| void ConnectionFromClient::enqueue(Buffer const& buffer) | ||||
| { | ||||
|     for (;;) { | ||||
|         auto success = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); | ||||
|  | @ -29,35 +29,35 @@ void ClientConnection::enqueue(Buffer const& buffer) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::async_enqueue(Buffer const& buffer) | ||||
| void ConnectionFromClient::async_enqueue(Buffer const& buffer) | ||||
| { | ||||
|     async_enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); | ||||
| } | ||||
| 
 | ||||
| bool ClientConnection::try_enqueue(Buffer const& buffer) | ||||
| bool ConnectionFromClient::try_enqueue(Buffer const& buffer) | ||||
| { | ||||
|     return enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::finished_playing_buffer(i32 buffer_id) | ||||
| void ConnectionFromClient::finished_playing_buffer(i32 buffer_id) | ||||
| { | ||||
|     if (on_finish_playing_buffer) | ||||
|         on_finish_playing_buffer(buffer_id); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::main_mix_muted_state_changed(bool muted) | ||||
| void ConnectionFromClient::main_mix_muted_state_changed(bool muted) | ||||
| { | ||||
|     if (on_main_mix_muted_state_change) | ||||
|         on_main_mix_muted_state_change(muted); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::main_mix_volume_changed(double volume) | ||||
| void ConnectionFromClient::main_mix_volume_changed(double volume) | ||||
| { | ||||
|     if (on_main_mix_volume_change) | ||||
|         on_main_mix_volume_change(volume); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::client_volume_changed(double volume) | ||||
| void ConnectionFromClient::client_volume_changed(double volume) | ||||
| { | ||||
|     if (on_client_volume_change) | ||||
|         on_client_volume_change(volume); | ||||
|  | @ -14,10 +14,10 @@ namespace Audio { | |||
| 
 | ||||
| class Buffer; | ||||
| 
 | ||||
| class ClientConnection final | ||||
| class ConnectionFromClient final | ||||
|     : public IPC::ServerConnection<AudioClientEndpoint, AudioServerEndpoint> | ||||
|     , public AudioClientEndpoint { | ||||
|     IPC_CLIENT_CONNECTION(ClientConnection, "/tmp/portal/audio") | ||||
|     IPC_CLIENT_CONNECTION(ConnectionFromClient, "/tmp/portal/audio") | ||||
| public: | ||||
|     void enqueue(Buffer const&); | ||||
|     bool try_enqueue(Buffer const&); | ||||
|  | @ -29,7 +29,7 @@ public: | |||
|     Function<void(double volume)> on_client_volume_change; | ||||
| 
 | ||||
| private: | ||||
|     ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
|     ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
| 
 | ||||
|     virtual void finished_playing_buffer(i32) override; | ||||
|     virtual void main_mix_muted_state_changed(bool) override; | ||||
|  | @ -17,14 +17,14 @@ NonnullRefPtr<T> new_client_connection(Args&&... args) | |||
| } | ||||
| 
 | ||||
| template<typename ClientEndpoint, typename ServerEndpoint> | ||||
| class ClientConnection : public Connection<ServerEndpoint, ClientEndpoint> | ||||
| class ConnectionFromClient : public Connection<ServerEndpoint, ClientEndpoint> | ||||
|     , public ServerEndpoint::Stub | ||||
|     , public ClientEndpoint::template Proxy<ServerEndpoint> { | ||||
| public: | ||||
|     using ServerStub = typename ServerEndpoint::Stub; | ||||
|     using IPCProxy = typename ClientEndpoint::template Proxy<ServerEndpoint>; | ||||
| 
 | ||||
|     ClientConnection(ServerStub& stub, NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|     ConnectionFromClient(ServerStub& stub, NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|         : IPC::Connection<ServerEndpoint, ClientEndpoint>(stub, move(socket)) | ||||
|         , ClientEndpoint::template Proxy<ServerEndpoint>(*this, {}) | ||||
|         , m_client_id(client_id) | ||||
|  | @ -36,7 +36,7 @@ public: | |||
|         }; | ||||
|     } | ||||
| 
 | ||||
|     virtual ~ClientConnection() override | ||||
|     virtual ~ConnectionFromClient() override | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|  | @ -69,5 +69,5 @@ private: | |||
| } | ||||
| 
 | ||||
| template<typename ClientEndpoint, typename ServerEndpoint> | ||||
| struct AK::Formatter<IPC::ClientConnection<ClientEndpoint, ServerEndpoint>> : Formatter<Core::Object> { | ||||
| struct AK::Formatter<IPC::ConnectionFromClient<ClientEndpoint, ServerEndpoint>> : Formatter<Core::Object> { | ||||
| }; | ||||
|  | @ -8,11 +8,11 @@ | |||
| 
 | ||||
| #include <AK/Error.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace IPC { | ||||
| 
 | ||||
| template<typename ClientConnectionType> | ||||
| template<typename ConnectionFromClientType> | ||||
| class MultiServer { | ||||
| public: | ||||
|     static ErrorOr<NonnullOwnPtr<MultiServer>> try_create(Optional<String> socket_path = {}) | ||||
|  | @ -28,7 +28,7 @@ private: | |||
|     { | ||||
|         m_server->on_accept = [&](auto client_socket) { | ||||
|             auto client_id = ++m_next_client_id; | ||||
|             (void)IPC::new_client_connection<ClientConnectionType>(move(client_socket), client_id); | ||||
|             (void)IPC::new_client_connection<ConnectionFromClientType>(move(client_socket), client_id); | ||||
|         }; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,15 +8,15 @@ | |||
| 
 | ||||
| #include <LibCore/System.h> | ||||
| #include <LibCore/SystemServerTakeover.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace IPC { | ||||
| 
 | ||||
| template<typename ClientConnectionType> | ||||
| ErrorOr<NonnullRefPtr<ClientConnectionType>> take_over_accepted_client_from_system_server() | ||||
| template<typename ConnectionFromClientType> | ||||
| ErrorOr<NonnullRefPtr<ConnectionFromClientType>> take_over_accepted_client_from_system_server() | ||||
| { | ||||
|     auto socket = TRY(Core::take_over_socket_from_system_server()); | ||||
|     return IPC::new_client_connection<ClientConnectionType>(move(socket)); | ||||
|     return IPC::new_client_connection<ConnectionFromClientType>(move(socket)); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ compile_ipc(AudioServer.ipc AudioServerEndpoint.h) | |||
| compile_ipc(AudioClient.ipc AudioClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     Mixer.cpp | ||||
|     main.cpp | ||||
|     AudioServerEndpoint.h | ||||
|  |  | |||
|  | @ -1,166 +0,0 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> | ||||
|  * | ||||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "Mixer.h" | ||||
| #include <AudioServer/AudioClientEndpoint.h> | ||||
| #include <LibAudio/Buffer.h> | ||||
| 
 | ||||
| namespace AudioServer { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| 
 | ||||
| void ClientConnection::for_each(Function<void(ClientConnection&)> callback) | ||||
| { | ||||
|     NonnullRefPtrVector<ClientConnection> connections; | ||||
|     for (auto& it : s_connections) | ||||
|         connections.append(*it.value); | ||||
|     for (auto& connection : connections) | ||||
|         callback(connection); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id, Mixer& mixer) | ||||
|     : IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint>(*this, move(client_socket), client_id) | ||||
|     , m_mixer(mixer) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id) | ||||
| { | ||||
|     async_finished_playing_buffer(buffer_id); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::did_change_main_mix_muted_state(Badge<Mixer>, bool muted) | ||||
| { | ||||
|     async_main_mix_muted_state_changed(muted); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::did_change_main_mix_volume(Badge<Mixer>, double volume) | ||||
| { | ||||
|     async_main_mix_volume_changed(volume); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::did_change_client_volume(Badge<ClientAudioStream>, double volume) | ||||
| { | ||||
|     async_client_volume_changed(volume); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetMainMixVolumeResponse ClientConnection::get_main_mix_volume() | ||||
| { | ||||
|     return m_mixer.main_volume(); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::set_main_mix_volume(double volume) | ||||
| { | ||||
|     m_mixer.set_main_volume(volume); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetSampleRateResponse ClientConnection::get_sample_rate() | ||||
| { | ||||
|     return { m_mixer.audiodevice_get_sample_rate() }; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::set_sample_rate(u32 sample_rate) | ||||
| { | ||||
|     m_mixer.audiodevice_set_sample_rate(sample_rate); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetSelfVolumeResponse ClientConnection::get_self_volume() | ||||
| { | ||||
|     return m_queue->volume().target(); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::set_self_volume(double volume) | ||||
| { | ||||
|     if (m_queue) | ||||
|         m_queue->set_volume(volume); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::EnqueueBufferResponse ClientConnection::enqueue_buffer(Core::AnonymousBuffer const& buffer, i32 buffer_id, int sample_count) | ||||
| { | ||||
|     if (!m_queue) | ||||
|         m_queue = m_mixer.create_queue(*this); | ||||
| 
 | ||||
|     if (m_queue->is_full()) | ||||
|         return false; | ||||
| 
 | ||||
|     // There's not a big allocation to worry about here.
 | ||||
|     m_queue->enqueue(MUST(Audio::Buffer::create_with_anonymous_buffer(buffer, buffer_id, sample_count))); | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetRemainingSamplesResponse ClientConnection::get_remaining_samples() | ||||
| { | ||||
|     int remaining = 0; | ||||
|     if (m_queue) | ||||
|         remaining = m_queue->get_remaining_samples(); | ||||
| 
 | ||||
|     return remaining; | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetPlayedSamplesResponse ClientConnection::get_played_samples() | ||||
| { | ||||
|     int played = 0; | ||||
|     if (m_queue) | ||||
|         played = m_queue->get_played_samples(); | ||||
| 
 | ||||
|     return played; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::set_paused(bool paused) | ||||
| { | ||||
|     if (m_queue) | ||||
|         m_queue->set_paused(paused); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::clear_buffer(bool paused) | ||||
| { | ||||
|     if (m_queue) | ||||
|         m_queue->clear(paused); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetPlayingBufferResponse ClientConnection::get_playing_buffer() | ||||
| { | ||||
|     int id = -1; | ||||
|     if (m_queue) | ||||
|         id = m_queue->get_playing_buffer(); | ||||
|     return id; | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::IsMainMixMutedResponse ClientConnection::is_main_mix_muted() | ||||
| { | ||||
|     return m_mixer.is_muted(); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::set_main_mix_muted(bool muted) | ||||
| { | ||||
|     m_mixer.set_muted(muted); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::IsSelfMutedResponse ClientConnection::is_self_muted() | ||||
| { | ||||
|     if (m_queue) | ||||
|         return m_queue->is_muted(); | ||||
| 
 | ||||
|     return false; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::set_self_muted(bool muted) | ||||
| { | ||||
|     if (m_queue) | ||||
|         m_queue->set_muted(muted); | ||||
| } | ||||
| } | ||||
							
								
								
									
										166
									
								
								Userland/Services/AudioServer/ConnectionFromClient.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										166
									
								
								Userland/Services/AudioServer/ConnectionFromClient.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,166 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> | ||||
|  * | ||||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ConnectionFromClient.h" | ||||
| #include "Mixer.h" | ||||
| #include <AudioServer/AudioClientEndpoint.h> | ||||
| #include <LibAudio/Buffer.h> | ||||
| 
 | ||||
| namespace AudioServer { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| void ConnectionFromClient::for_each(Function<void(ConnectionFromClient&)> callback) | ||||
| { | ||||
|     NonnullRefPtrVector<ConnectionFromClient> connections; | ||||
|     for (auto& it : s_connections) | ||||
|         connections.append(*it.value); | ||||
|     for (auto& connection : connections) | ||||
|         callback(connection); | ||||
| } | ||||
| 
 | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id, Mixer& mixer) | ||||
|     : IPC::ConnectionFromClient<AudioClientEndpoint, AudioServerEndpoint>(*this, move(client_socket), client_id) | ||||
|     , m_mixer(mixer) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id) | ||||
| { | ||||
|     async_finished_playing_buffer(buffer_id); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::did_change_main_mix_muted_state(Badge<Mixer>, bool muted) | ||||
| { | ||||
|     async_main_mix_muted_state_changed(muted); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::did_change_main_mix_volume(Badge<Mixer>, double volume) | ||||
| { | ||||
|     async_main_mix_volume_changed(volume); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::did_change_client_volume(Badge<ClientAudioStream>, double volume) | ||||
| { | ||||
|     async_client_volume_changed(volume); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetMainMixVolumeResponse ConnectionFromClient::get_main_mix_volume() | ||||
| { | ||||
|     return m_mixer.main_volume(); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::set_main_mix_volume(double volume) | ||||
| { | ||||
|     m_mixer.set_main_volume(volume); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetSampleRateResponse ConnectionFromClient::get_sample_rate() | ||||
| { | ||||
|     return { m_mixer.audiodevice_get_sample_rate() }; | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::set_sample_rate(u32 sample_rate) | ||||
| { | ||||
|     m_mixer.audiodevice_set_sample_rate(sample_rate); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetSelfVolumeResponse ConnectionFromClient::get_self_volume() | ||||
| { | ||||
|     return m_queue->volume().target(); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::set_self_volume(double volume) | ||||
| { | ||||
|     if (m_queue) | ||||
|         m_queue->set_volume(volume); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::EnqueueBufferResponse ConnectionFromClient::enqueue_buffer(Core::AnonymousBuffer const& buffer, i32 buffer_id, int sample_count) | ||||
| { | ||||
|     if (!m_queue) | ||||
|         m_queue = m_mixer.create_queue(*this); | ||||
| 
 | ||||
|     if (m_queue->is_full()) | ||||
|         return false; | ||||
| 
 | ||||
|     // There's not a big allocation to worry about here.
 | ||||
|     m_queue->enqueue(MUST(Audio::Buffer::create_with_anonymous_buffer(buffer, buffer_id, sample_count))); | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetRemainingSamplesResponse ConnectionFromClient::get_remaining_samples() | ||||
| { | ||||
|     int remaining = 0; | ||||
|     if (m_queue) | ||||
|         remaining = m_queue->get_remaining_samples(); | ||||
| 
 | ||||
|     return remaining; | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetPlayedSamplesResponse ConnectionFromClient::get_played_samples() | ||||
| { | ||||
|     int played = 0; | ||||
|     if (m_queue) | ||||
|         played = m_queue->get_played_samples(); | ||||
| 
 | ||||
|     return played; | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::set_paused(bool paused) | ||||
| { | ||||
|     if (m_queue) | ||||
|         m_queue->set_paused(paused); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::clear_buffer(bool paused) | ||||
| { | ||||
|     if (m_queue) | ||||
|         m_queue->clear(paused); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::GetPlayingBufferResponse ConnectionFromClient::get_playing_buffer() | ||||
| { | ||||
|     int id = -1; | ||||
|     if (m_queue) | ||||
|         id = m_queue->get_playing_buffer(); | ||||
|     return id; | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::IsMainMixMutedResponse ConnectionFromClient::is_main_mix_muted() | ||||
| { | ||||
|     return m_mixer.is_muted(); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::set_main_mix_muted(bool muted) | ||||
| { | ||||
|     m_mixer.set_muted(muted); | ||||
| } | ||||
| 
 | ||||
| Messages::AudioServer::IsSelfMutedResponse ConnectionFromClient::is_self_muted() | ||||
| { | ||||
|     if (m_queue) | ||||
|         return m_queue->is_muted(); | ||||
| 
 | ||||
|     return false; | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::set_self_muted(bool muted) | ||||
| { | ||||
|     if (m_queue) | ||||
|         m_queue->set_muted(muted); | ||||
| } | ||||
| } | ||||
|  | @ -9,7 +9,7 @@ | |||
| #include <AK/HashMap.h> | ||||
| #include <AudioServer/AudioClientEndpoint.h> | ||||
| #include <AudioServer/AudioServerEndpoint.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace Audio { | ||||
| class Buffer; | ||||
|  | @ -20,10 +20,10 @@ namespace AudioServer { | |||
| class ClientAudioStream; | ||||
| class Mixer; | ||||
| 
 | ||||
| class ClientConnection final : public IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection) | ||||
| class ConnectionFromClient final : public IPC::ConnectionFromClient<AudioClientEndpoint, AudioServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient) | ||||
| public: | ||||
|     ~ClientConnection() override; | ||||
|     ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     void did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id); | ||||
|     void did_change_client_volume(Badge<ClientAudioStream>, double volume); | ||||
|  | @ -32,10 +32,10 @@ public: | |||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
|     static void for_each(Function<void(ClientConnection&)>); | ||||
|     static void for_each(Function<void(ConnectionFromClient&)>); | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id, Mixer& mixer); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id, Mixer& mixer); | ||||
| 
 | ||||
|     virtual Messages::AudioServer::GetMainMixVolumeResponse get_main_mix_volume() override; | ||||
|     virtual void set_main_mix_volume(double) override; | ||||
|  | @ -10,7 +10,7 @@ | |||
| #include <AK/Array.h> | ||||
| #include <AK/MemoryStream.h> | ||||
| #include <AK/NumericLimits.h> | ||||
| #include <AudioServer/ClientConnection.h> | ||||
| #include <AudioServer/ConnectionFromClient.h> | ||||
| #include <AudioServer/Mixer.h> | ||||
| #include <LibCore/ConfigFile.h> | ||||
| #include <LibCore/Timer.h> | ||||
|  | @ -48,7 +48,7 @@ Mixer::~Mixer() | |||
| { | ||||
| } | ||||
| 
 | ||||
| NonnullRefPtr<ClientAudioStream> Mixer::create_queue(ClientConnection& client) | ||||
| NonnullRefPtr<ClientAudioStream> Mixer::create_queue(ConnectionFromClient& client) | ||||
| { | ||||
|     auto queue = adopt_ref(*new ClientAudioStream(client)); | ||||
|     m_pending_mutex.lock(); | ||||
|  | @ -149,7 +149,7 @@ void Mixer::set_main_volume(double volume) | |||
|     m_config->write_num_entry("Master", "Volume", static_cast<int>(volume * 100)); | ||||
|     request_setting_sync(); | ||||
| 
 | ||||
|     ClientConnection::for_each([&](ClientConnection& client) { | ||||
|     ConnectionFromClient::for_each([&](ConnectionFromClient& client) { | ||||
|         client.did_change_main_mix_volume({}, main_volume()); | ||||
|     }); | ||||
| } | ||||
|  | @ -163,7 +163,7 @@ void Mixer::set_muted(bool muted) | |||
|     m_config->write_bool_entry("Master", "Mute", m_muted); | ||||
|     request_setting_sync(); | ||||
| 
 | ||||
|     ClientConnection::for_each([muted](ClientConnection& client) { | ||||
|     ConnectionFromClient::for_each([muted](ConnectionFromClient& client) { | ||||
|         client.did_change_main_mix_muted_state({}, muted); | ||||
|     }); | ||||
| } | ||||
|  | @ -199,7 +199,7 @@ void Mixer::request_setting_sync() | |||
|     } | ||||
| } | ||||
| 
 | ||||
| ClientAudioStream::ClientAudioStream(ClientConnection& client) | ||||
| ClientAudioStream::ClientAudioStream(ConnectionFromClient& client) | ||||
|     : m_client(client) | ||||
| { | ||||
| } | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include "FadingProperty.h" | ||||
| #include <AK/Atomic.h> | ||||
| #include <AK/Badge.h> | ||||
|  | @ -30,11 +30,11 @@ namespace AudioServer { | |||
| // This is to prevent clipping when two streams with low headroom (e.g. normalized & compressed) are playing.
 | ||||
| constexpr double SAMPLE_HEADROOM = 0.7; | ||||
| 
 | ||||
| class ClientConnection; | ||||
| class ConnectionFromClient; | ||||
| 
 | ||||
| class ClientAudioStream : public RefCounted<ClientAudioStream> { | ||||
| public: | ||||
|     explicit ClientAudioStream(ClientConnection&); | ||||
|     explicit ClientAudioStream(ConnectionFromClient&); | ||||
|     ~ClientAudioStream() { } | ||||
| 
 | ||||
|     bool is_full() const { return m_queue.size() >= 3; } | ||||
|  | @ -64,7 +64,7 @@ public: | |||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     ClientConnection* client() { return m_client.ptr(); } | ||||
|     ConnectionFromClient* client() { return m_client.ptr(); } | ||||
| 
 | ||||
|     void clear(bool paused = false) | ||||
|     { | ||||
|  | @ -105,7 +105,7 @@ private: | |||
|     bool m_paused { false }; | ||||
|     bool m_muted { false }; | ||||
| 
 | ||||
|     WeakPtr<ClientConnection> m_client; | ||||
|     WeakPtr<ConnectionFromClient> m_client; | ||||
|     FadingProperty<double> m_volume { 1 }; | ||||
| }; | ||||
| 
 | ||||
|  | @ -114,7 +114,7 @@ class Mixer : public Core::Object { | |||
| public: | ||||
|     virtual ~Mixer() override; | ||||
| 
 | ||||
|     NonnullRefPtr<ClientAudioStream> create_queue(ClientConnection&); | ||||
|     NonnullRefPtr<ClientAudioStream> create_queue(ConnectionFromClient&); | ||||
| 
 | ||||
|     // To the outside world, we pretend that the target volume is already reached, even though it may be still fading.
 | ||||
|     double main_volume() const { return m_main_volume.target(); } | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
|     server->on_accept = [&](NonnullOwnPtr<Core::Stream::LocalSocket> client_socket) { | ||||
|         static int s_next_client_id = 0; | ||||
|         int client_id = ++s_next_client_id; | ||||
|         (void)IPC::new_client_connection<AudioServer::ClientConnection>(move(client_socket), client_id, *mixer); | ||||
|         (void)IPC::new_client_connection<AudioServer::ConnectionFromClient>(move(client_socket), client_id, *mixer); | ||||
|     }; | ||||
| 
 | ||||
|     TRY(Core::System::pledge("stdio recvfd thread accept cpath rpath wpath")); | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ compile_ipc(ClipboardServer.ipc ClipboardServerEndpoint.h) | |||
| compile_ipc(ClipboardClient.ipc ClipboardClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     ClipboardClientEndpoint.h | ||||
|     ClipboardServerEndpoint.h | ||||
|     Storage.cpp | ||||
|  |  | |||
|  | @ -1,53 +0,0 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> | ||||
|  * | ||||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <Clipboard/ClientConnection.h> | ||||
| #include <Clipboard/ClipboardClientEndpoint.h> | ||||
| #include <Clipboard/Storage.h> | ||||
| 
 | ||||
| namespace Clipboard { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| 
 | ||||
| void ClientConnection::for_each_client(Function<void(ClientConnection&)> callback) | ||||
| { | ||||
|     for (auto& it : s_connections) { | ||||
|         callback(*it.value); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|     : IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint>(*this, move(socket), client_id) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::set_clipboard_data(Core::AnonymousBuffer const& data, String const& mime_type, IPC::Dictionary const& metadata) | ||||
| { | ||||
|     Storage::the().set_data(data, mime_type, metadata.entries()); | ||||
| } | ||||
| 
 | ||||
| Messages::ClipboardServer::GetClipboardDataResponse ClientConnection::get_clipboard_data() | ||||
| { | ||||
|     auto& storage = Storage::the(); | ||||
|     return { storage.buffer(), storage.mime_type(), storage.metadata() }; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::notify_about_clipboard_change() | ||||
| { | ||||
|     async_clipboard_data_changed(Storage::the().mime_type()); | ||||
| } | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										53
									
								
								Userland/Services/Clipboard/ConnectionFromClient.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								Userland/Services/Clipboard/ConnectionFromClient.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,53 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> | ||||
|  * | ||||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <Clipboard/ClipboardClientEndpoint.h> | ||||
| #include <Clipboard/ConnectionFromClient.h> | ||||
| #include <Clipboard/Storage.h> | ||||
| 
 | ||||
| namespace Clipboard { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| void ConnectionFromClient::for_each_client(Function<void(ConnectionFromClient&)> callback) | ||||
| { | ||||
|     for (auto& it : s_connections) { | ||||
|         callback(*it.value); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|     : IPC::ConnectionFromClient<ClipboardClientEndpoint, ClipboardServerEndpoint>(*this, move(socket), client_id) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::set_clipboard_data(Core::AnonymousBuffer const& data, String const& mime_type, IPC::Dictionary const& metadata) | ||||
| { | ||||
|     Storage::the().set_data(data, mime_type, metadata.entries()); | ||||
| } | ||||
| 
 | ||||
| Messages::ClipboardServer::GetClipboardDataResponse ConnectionFromClient::get_clipboard_data() | ||||
| { | ||||
|     auto& storage = Storage::the(); | ||||
|     return { storage.buffer(), storage.mime_type(), storage.metadata() }; | ||||
| } | ||||
| 
 | ||||
| void ConnectionFromClient::notify_about_clipboard_change() | ||||
| { | ||||
|     async_clipboard_data_changed(Storage::the().mime_type()); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  | @ -9,25 +9,25 @@ | |||
| #include <AK/HashMap.h> | ||||
| #include <Clipboard/ClipboardClientEndpoint.h> | ||||
| #include <Clipboard/ClipboardServerEndpoint.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace Clipboard { | ||||
| 
 | ||||
| class ClientConnection final | ||||
|     : public IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection); | ||||
| class ConnectionFromClient final | ||||
|     : public IPC::ConnectionFromClient<ClipboardClientEndpoint, ClipboardServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient); | ||||
| 
 | ||||
| public: | ||||
|     virtual ~ClientConnection() override; | ||||
|     virtual ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
|     static void for_each_client(Function<void(ClientConnection&)>); | ||||
|     static void for_each_client(Function<void(ConnectionFromClient&)>); | ||||
| 
 | ||||
|     void notify_about_clipboard_change(); | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
| 
 | ||||
|     virtual Messages::ClipboardServer::GetClipboardDataResponse get_clipboard_data() override; | ||||
|     virtual void set_clipboard_data(Core::AnonymousBuffer const&, String const&, IPC::Dictionary const&) override; | ||||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <Clipboard/ClientConnection.h> | ||||
| #include <Clipboard/ConnectionFromClient.h> | ||||
| #include <Clipboard/Storage.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/System.h> | ||||
|  | @ -17,10 +17,10 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
|     Core::EventLoop event_loop; | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto server = TRY(IPC::MultiServer<Clipboard::ClientConnection>::try_create()); | ||||
|     auto server = TRY(IPC::MultiServer<Clipboard::ConnectionFromClient>::try_create()); | ||||
| 
 | ||||
|     Clipboard::Storage::the().on_content_change = [&] { | ||||
|         Clipboard::ClientConnection::for_each_client([&](auto& client) { | ||||
|         Clipboard::ConnectionFromClient::for_each_client([&](auto& client) { | ||||
|             client.notify_about_clipboard_change(); | ||||
|         }); | ||||
|     }; | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ compile_ipc(ConfigServer.ipc ConfigServerEndpoint.h) | |||
| compile_ipc(ConfigClient.ipc ConfigClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     main.cpp | ||||
|     ConfigServerEndpoint.h | ||||
|     ConfigClientEndpoint.h | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include <ConfigServer/ConfigClientEndpoint.h> | ||||
| #include <LibCore/ConfigFile.h> | ||||
| #include <LibCore/FileWatcher.h> | ||||
|  | @ -12,7 +12,7 @@ | |||
| 
 | ||||
| namespace ConfigServer { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| struct CachedDomain { | ||||
|     String domain; | ||||
|  | @ -23,7 +23,7 @@ struct CachedDomain { | |||
| static HashMap<String, NonnullOwnPtr<CachedDomain>> s_cache; | ||||
| static constexpr int s_disk_sync_delay_ms = 5'000; | ||||
| 
 | ||||
| static void for_each_monitoring_connection(String const& domain, ClientConnection* excluded_connection, Function<void(ClientConnection&)> callback) | ||||
| static void for_each_monitoring_connection(String const& domain, ConnectionFromClient* excluded_connection, Function<void(ConnectionFromClient&)> callback) | ||||
| { | ||||
|     for (auto& it : s_connections) { | ||||
|         if (it.value->is_monitoring_domain(domain) && (!excluded_connection || it.value != excluded_connection)) | ||||
|  | @ -48,7 +48,7 @@ static Core::ConfigFile& ensure_domain_config(String const& domain) | |||
|         for (auto& group : config->groups()) { | ||||
|             for (auto& key : config->keys(group)) { | ||||
|                 if (!new_config->has_key(group, key)) { | ||||
|                     for_each_monitoring_connection(domain, nullptr, [&domain, &group, &key](ClientConnection& connection) { | ||||
|                     for_each_monitoring_connection(domain, nullptr, [&domain, &group, &key](ConnectionFromClient& connection) { | ||||
|                         connection.async_notify_removed_key(domain, group, key); | ||||
|                     }); | ||||
|                 } | ||||
|  | @ -60,7 +60,7 @@ static Core::ConfigFile& ensure_domain_config(String const& domain) | |||
|                 auto old_value = config->read_entry(group, key); | ||||
|                 auto new_value = new_config->read_entry(group, key); | ||||
|                 if (old_value != new_value) { | ||||
|                     for_each_monitoring_connection(domain, nullptr, [&domain, &group, &key, &new_value](ClientConnection& connection) { | ||||
|                     for_each_monitoring_connection(domain, nullptr, [&domain, &group, &key, &new_value](ConnectionFromClient& connection) { | ||||
|                         connection.async_notify_changed_string_value(domain, group, key, new_value); | ||||
|                     }); | ||||
|                 } | ||||
|  | @ -74,25 +74,25 @@ static Core::ConfigFile& ensure_domain_config(String const& domain) | |||
|     return *config; | ||||
| } | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) | ||||
|     : IPC::ClientConnection<ConfigClientEndpoint, ConfigServerEndpoint>(*this, move(client_socket), client_id) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) | ||||
|     : IPC::ConnectionFromClient<ConfigClientEndpoint, ConfigServerEndpoint>(*this, move(client_socket), client_id) | ||||
|     , m_sync_timer(Core::Timer::create_single_shot(s_disk_sync_delay_ms, [this]() { sync_dirty_domains_to_disk(); })) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
|     m_sync_timer->stop(); | ||||
|     sync_dirty_domains_to_disk(); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::pledge_domains(Vector<String> const& domains) | ||||
| void ConnectionFromClient::pledge_domains(Vector<String> const& domains) | ||||
| { | ||||
|     if (m_has_pledged) { | ||||
|         did_misbehave("Tried to pledge domains twice."); | ||||
|  | @ -103,7 +103,7 @@ void ClientConnection::pledge_domains(Vector<String> const& domains) | |||
|         m_pledged_domains.set(domain); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::monitor_domain(String const& domain) | ||||
| void ConnectionFromClient::monitor_domain(String const& domain) | ||||
| { | ||||
|     if (m_has_pledged && !m_pledged_domains.contains(domain)) { | ||||
|         did_misbehave("Attempt to monitor non-pledged domain"); | ||||
|  | @ -113,7 +113,7 @@ void ClientConnection::monitor_domain(String const& domain) | |||
|     m_monitored_domains.set(domain); | ||||
| } | ||||
| 
 | ||||
| bool ClientConnection::validate_access(String const& domain, String const& group, String const& key) | ||||
| bool ConnectionFromClient::validate_access(String const& domain, String const& group, String const& key) | ||||
| { | ||||
|     if (!m_has_pledged) | ||||
|         return true; | ||||
|  | @ -123,7 +123,7 @@ bool ClientConnection::validate_access(String const& domain, String const& group | |||
|     return false; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::sync_dirty_domains_to_disk() | ||||
| void ConnectionFromClient::sync_dirty_domains_to_disk() | ||||
| { | ||||
|     if (m_dirty_domains.is_empty()) | ||||
|         return; | ||||
|  | @ -139,7 +139,7 @@ void ClientConnection::sync_dirty_domains_to_disk() | |||
|     } | ||||
| } | ||||
| 
 | ||||
| Messages::ConfigServer::ListConfigKeysResponse ClientConnection::list_config_keys(String const& domain, String const& group) | ||||
| Messages::ConfigServer::ListConfigKeysResponse ConnectionFromClient::list_config_keys(String const& domain, String const& group) | ||||
| { | ||||
|     if (!validate_access(domain, group, "")) | ||||
|         return Vector<String> {}; | ||||
|  | @ -147,7 +147,7 @@ Messages::ConfigServer::ListConfigKeysResponse ClientConnection::list_config_key | |||
|     return { config.keys(group) }; | ||||
| } | ||||
| 
 | ||||
| Messages::ConfigServer::ListConfigGroupsResponse ClientConnection::list_config_groups(String const& domain) | ||||
| Messages::ConfigServer::ListConfigGroupsResponse ConnectionFromClient::list_config_groups(String const& domain) | ||||
| { | ||||
|     if (!validate_access(domain, "", "")) | ||||
|         return Vector<String> {}; | ||||
|  | @ -155,7 +155,7 @@ Messages::ConfigServer::ListConfigGroupsResponse ClientConnection::list_config_g | |||
|     return { config.groups() }; | ||||
| } | ||||
| 
 | ||||
| Messages::ConfigServer::ReadStringValueResponse ClientConnection::read_string_value(String const& domain, String const& group, String const& key) | ||||
| Messages::ConfigServer::ReadStringValueResponse ConnectionFromClient::read_string_value(String const& domain, String const& group, String const& key) | ||||
| { | ||||
|     if (!validate_access(domain, group, key)) | ||||
|         return nullptr; | ||||
|  | @ -166,7 +166,7 @@ Messages::ConfigServer::ReadStringValueResponse ClientConnection::read_string_va | |||
|     return Optional<String> { config.read_entry(group, key) }; | ||||
| } | ||||
| 
 | ||||
| Messages::ConfigServer::ReadI32ValueResponse ClientConnection::read_i32_value(String const& domain, String const& group, String const& key) | ||||
| Messages::ConfigServer::ReadI32ValueResponse ConnectionFromClient::read_i32_value(String const& domain, String const& group, String const& key) | ||||
| { | ||||
|     if (!validate_access(domain, group, key)) | ||||
|         return nullptr; | ||||
|  | @ -177,7 +177,7 @@ Messages::ConfigServer::ReadI32ValueResponse ClientConnection::read_i32_value(St | |||
|     return Optional<i32> { config.read_num_entry(group, key) }; | ||||
| } | ||||
| 
 | ||||
| Messages::ConfigServer::ReadBoolValueResponse ClientConnection::read_bool_value(String const& domain, String const& group, String const& key) | ||||
| Messages::ConfigServer::ReadBoolValueResponse ConnectionFromClient::read_bool_value(String const& domain, String const& group, String const& key) | ||||
| { | ||||
|     if (!validate_access(domain, group, key)) | ||||
|         return nullptr; | ||||
|  | @ -188,7 +188,7 @@ Messages::ConfigServer::ReadBoolValueResponse ClientConnection::read_bool_value( | |||
|     return Optional<bool> { config.read_bool_entry(group, key) }; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::start_or_restart_sync_timer() | ||||
| void ConnectionFromClient::start_or_restart_sync_timer() | ||||
| { | ||||
|     if (m_sync_timer->is_active()) | ||||
|         m_sync_timer->restart(); | ||||
|  | @ -196,7 +196,7 @@ void ClientConnection::start_or_restart_sync_timer() | |||
|         m_sync_timer->start(); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::write_string_value(String const& domain, String const& group, String const& key, String const& value) | ||||
| void ConnectionFromClient::write_string_value(String const& domain, String const& group, String const& key, String const& value) | ||||
| { | ||||
|     if (!validate_access(domain, group, key)) | ||||
|         return; | ||||
|  | @ -210,12 +210,12 @@ void ClientConnection::write_string_value(String const& domain, String const& gr | |||
|     m_dirty_domains.set(domain); | ||||
|     start_or_restart_sync_timer(); | ||||
| 
 | ||||
|     for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ClientConnection& connection) { | ||||
|     for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ConnectionFromClient& connection) { | ||||
|         connection.async_notify_changed_string_value(domain, group, key, value); | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::write_i32_value(String const& domain, String const& group, String const& key, i32 value) | ||||
| void ConnectionFromClient::write_i32_value(String const& domain, String const& group, String const& key, i32 value) | ||||
| { | ||||
|     if (!validate_access(domain, group, key)) | ||||
|         return; | ||||
|  | @ -229,12 +229,12 @@ void ClientConnection::write_i32_value(String const& domain, String const& group | |||
|     m_dirty_domains.set(domain); | ||||
|     start_or_restart_sync_timer(); | ||||
| 
 | ||||
|     for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ClientConnection& connection) { | ||||
|     for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ConnectionFromClient& connection) { | ||||
|         connection.async_notify_changed_i32_value(domain, group, key, value); | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::write_bool_value(String const& domain, String const& group, String const& key, bool value) | ||||
| void ConnectionFromClient::write_bool_value(String const& domain, String const& group, String const& key, bool value) | ||||
| { | ||||
|     if (!validate_access(domain, group, key)) | ||||
|         return; | ||||
|  | @ -248,12 +248,12 @@ void ClientConnection::write_bool_value(String const& domain, String const& grou | |||
|     m_dirty_domains.set(domain); | ||||
|     start_or_restart_sync_timer(); | ||||
| 
 | ||||
|     for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ClientConnection& connection) { | ||||
|     for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ConnectionFromClient& connection) { | ||||
|         connection.async_notify_changed_bool_value(domain, group, key, value); | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::remove_key(String const& domain, String const& group, String const& key) | ||||
| void ConnectionFromClient::remove_key(String const& domain, String const& group, String const& key) | ||||
| { | ||||
|     if (!validate_access(domain, group, key)) | ||||
|         return; | ||||
|  | @ -266,7 +266,7 @@ void ClientConnection::remove_key(String const& domain, String const& group, Str | |||
|     m_dirty_domains.set(domain); | ||||
|     start_or_restart_sync_timer(); | ||||
| 
 | ||||
|     for_each_monitoring_connection(domain, this, [&domain, &group, &key](ClientConnection& connection) { | ||||
|     for_each_monitoring_connection(domain, this, [&domain, &group, &key](ConnectionFromClient& connection) { | ||||
|         connection.async_notify_removed_key(domain, group, key); | ||||
|     }); | ||||
| } | ||||
|  | @ -6,24 +6,24 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| 
 | ||||
| #include <ConfigServer/ConfigClientEndpoint.h> | ||||
| #include <ConfigServer/ConfigServerEndpoint.h> | ||||
| 
 | ||||
| namespace ConfigServer { | ||||
| 
 | ||||
| class ClientConnection final : public IPC::ClientConnection<ConfigClientEndpoint, ConfigServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection) | ||||
| class ConnectionFromClient final : public IPC::ConnectionFromClient<ConfigClientEndpoint, ConfigServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient) | ||||
| public: | ||||
|     ~ClientConnection() override; | ||||
|     ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
|     bool is_monitoring_domain(String const& domain) const { return m_monitored_domains.contains(domain); } | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
| 
 | ||||
|     virtual void pledge_domains(Vector<String> const&) override; | ||||
|     virtual void monitor_domain(String const&) override; | ||||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include <LibCore/StandardPaths.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibIPC/MultiServer.h> | ||||
|  | @ -18,6 +18,6 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
| 
 | ||||
|     Core::EventLoop event_loop; | ||||
| 
 | ||||
|     auto server = TRY(IPC::MultiServer<ConfigServer::ClientConnection>::try_create()); | ||||
|     auto server = TRY(IPC::MultiServer<ConfigServer::ConnectionFromClient>::try_create()); | ||||
|     return event_loop.exec(); | ||||
| } | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ compile_ipc(FileSystemAccessServer.ipc FileSystemAccessServerEndpoint.h) | |||
| compile_ipc(FileSystemAccessClient.ipc FileSystemAccessClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     main.cpp | ||||
|     FileSystemAccessServerEndpoint.h | ||||
|     FileSystemAccessClientEndpoint.h | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ | |||
| #include <LibGUI/WindowServerConnection.h> | ||||
| // clang-format on
 | ||||
| #include <AK/Debug.h> | ||||
| #include <FileSystemAccessServer/ClientConnection.h> | ||||
| #include <FileSystemAccessServer/ConnectionFromClient.h> | ||||
| #include <LibCore/File.h> | ||||
| #include <LibCore/IODevice.h> | ||||
| #include <LibGUI/Application.h> | ||||
|  | @ -18,25 +18,25 @@ | |||
| 
 | ||||
| namespace FileSystemAccessServer { | ||||
| 
 | ||||
| static HashMap<int, NonnullRefPtr<ClientConnection>> s_connections; | ||||
| static HashMap<int, NonnullRefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|     : IPC::ClientConnection<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint>(*this, move(socket), 1) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|     : IPC::ConnectionFromClient<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint>(*this, move(socket), 1) | ||||
| { | ||||
|     s_connections.set(1, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
|     GUI::Application::the()->quit(); | ||||
| } | ||||
| 
 | ||||
| RefPtr<GUI::Window> ClientConnection::create_dummy_child_window(i32 window_server_client_id, i32 parent_window_id) | ||||
| RefPtr<GUI::Window> ConnectionFromClient::create_dummy_child_window(i32 window_server_client_id, i32 parent_window_id) | ||||
| { | ||||
|     auto window = GUI::Window::construct(); | ||||
|     window->set_opacity(0); | ||||
|  | @ -49,7 +49,7 @@ RefPtr<GUI::Window> ClientConnection::create_dummy_child_window(i32 window_serve | |||
|     return window; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::request_file_handler(i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access, ShouldPrompt prompt) | ||||
| void ConnectionFromClient::request_file_handler(i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access, ShouldPrompt prompt) | ||||
| { | ||||
|     VERIFY(path.starts_with("/"sv)); | ||||
| 
 | ||||
|  | @ -110,17 +110,17 @@ void ClientConnection::request_file_handler(i32 window_server_client_id, i32 par | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::request_file_read_only_approved(i32 window_server_client_id, i32 parent_window_id, String const& path) | ||||
| void ConnectionFromClient::request_file_read_only_approved(i32 window_server_client_id, i32 parent_window_id, String const& path) | ||||
| { | ||||
|     request_file_handler(window_server_client_id, parent_window_id, path, Core::OpenMode::ReadOnly, ShouldPrompt::No); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::request_file(i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access) | ||||
| void ConnectionFromClient::request_file(i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access) | ||||
| { | ||||
|     request_file_handler(window_server_client_id, parent_window_id, path, requested_access, ShouldPrompt::Yes); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::prompt_open_file(i32 window_server_client_id, i32 parent_window_id, String const& window_title, String const& path_to_view, Core::OpenMode const& requested_access) | ||||
| void ConnectionFromClient::prompt_open_file(i32 window_server_client_id, i32 parent_window_id, String const& window_title, String const& path_to_view, Core::OpenMode const& requested_access) | ||||
| { | ||||
|     auto relevant_permissions = requested_access & (Core::OpenMode::ReadOnly | Core::OpenMode::WriteOnly); | ||||
|     VERIFY(relevant_permissions != Core::OpenMode::NotOpen); | ||||
|  | @ -132,7 +132,7 @@ void ClientConnection::prompt_open_file(i32 window_server_client_id, i32 parent_ | |||
|     prompt_helper(user_picked_file, requested_access); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::prompt_save_file(i32 window_server_client_id, i32 parent_window_id, String const& name, String const& ext, String const& path_to_view, Core::OpenMode const& requested_access) | ||||
| void ConnectionFromClient::prompt_save_file(i32 window_server_client_id, i32 parent_window_id, String const& name, String const& ext, String const& path_to_view, Core::OpenMode const& requested_access) | ||||
| { | ||||
|     auto relevant_permissions = requested_access & (Core::OpenMode::ReadOnly | Core::OpenMode::WriteOnly); | ||||
|     VERIFY(relevant_permissions != Core::OpenMode::NotOpen); | ||||
|  | @ -144,7 +144,7 @@ void ClientConnection::prompt_save_file(i32 window_server_client_id, i32 parent_ | |||
|     prompt_helper(user_picked_file, requested_access); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::prompt_helper(Optional<String> const& user_picked_file, Core::OpenMode const& requested_access) | ||||
| void ConnectionFromClient::prompt_helper(Optional<String> const& user_picked_file, Core::OpenMode const& requested_access) | ||||
| { | ||||
|     if (user_picked_file.has_value()) { | ||||
|         VERIFY(user_picked_file->starts_with("/"sv)); | ||||
|  | @ -169,7 +169,7 @@ void ClientConnection::prompt_helper(Optional<String> const& user_picked_file, C | |||
|     } | ||||
| } | ||||
| 
 | ||||
| Messages::FileSystemAccessServer::ExposeWindowServerClientIdResponse ClientConnection::expose_window_server_client_id() | ||||
| Messages::FileSystemAccessServer::ExposeWindowServerClientIdResponse ConnectionFromClient::expose_window_server_client_id() | ||||
| { | ||||
|     return GUI::WindowServerConnection::the().expose_client_id(); | ||||
| } | ||||
|  | @ -11,21 +11,21 @@ | |||
| #include <FileSystemAccessServer/FileSystemAccessServerEndpoint.h> | ||||
| #include <LibCore/Forward.h> | ||||
| #include <LibGUI/Forward.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace FileSystemAccessServer { | ||||
| 
 | ||||
| class ClientConnection final | ||||
|     : public IPC::ClientConnection<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection); | ||||
| class ConnectionFromClient final | ||||
|     : public IPC::ConnectionFromClient<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient); | ||||
| 
 | ||||
| public: | ||||
|     ~ClientConnection() override; | ||||
|     ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
| 
 | ||||
|     virtual void request_file_read_only_approved(i32, i32, String const&) override; | ||||
|     virtual void request_file(i32, i32, String const&, Core::OpenMode const&) override; | ||||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <FileSystemAccessServer/ClientConnection.h> | ||||
| #include <FileSystemAccessServer/ConnectionFromClient.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibIPC/SingleServer.h> | ||||
|  | @ -17,6 +17,6 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
|     auto app = GUI::Application::construct(0, nullptr); | ||||
|     app->set_quit_when_last_window_deleted(false); | ||||
| 
 | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<FileSystemAccessServer::ClientConnection>()); | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<FileSystemAccessServer::ConnectionFromClient>()); | ||||
|     return app->exec(); | ||||
| } | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ compile_ipc(ImageDecoderServer.ipc ImageDecoderServerEndpoint.h) | |||
| compile_ipc(ImageDecoderClient.ipc ImageDecoderClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     main.cpp | ||||
|     ImageDecoderServerEndpoint.h | ||||
|     ImageDecoderClientEndpoint.h | ||||
|  |  | |||
|  | @ -5,28 +5,28 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <AK/Debug.h> | ||||
| #include <ImageDecoder/ClientConnection.h> | ||||
| #include <ImageDecoder/ConnectionFromClient.h> | ||||
| #include <ImageDecoder/ImageDecoderClientEndpoint.h> | ||||
| #include <LibGfx/Bitmap.h> | ||||
| #include <LibGfx/ImageDecoder.h> | ||||
| 
 | ||||
| namespace ImageDecoder { | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|     : IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>(*this, move(socket), 1) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|     : IPC::ConnectionFromClient<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>(*this, move(socket), 1) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     Core::EventLoop::current().quit(0); | ||||
| } | ||||
| 
 | ||||
| Messages::ImageDecoderServer::DecodeImageResponse ClientConnection::decode_image(Core::AnonymousBuffer const& encoded_buffer) | ||||
| Messages::ImageDecoderServer::DecodeImageResponse ConnectionFromClient::decode_image(Core::AnonymousBuffer const& encoded_buffer) | ||||
| { | ||||
|     if (!encoded_buffer.is_valid()) { | ||||
|         dbgln_if(IMAGE_DECODER_DEBUG, "Encoded data is invalid"); | ||||
|  | @ -10,22 +10,22 @@ | |||
| #include <ImageDecoder/Forward.h> | ||||
| #include <ImageDecoder/ImageDecoderClientEndpoint.h> | ||||
| #include <ImageDecoder/ImageDecoderServerEndpoint.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| #include <LibWeb/Forward.h> | ||||
| 
 | ||||
| namespace ImageDecoder { | ||||
| 
 | ||||
| class ClientConnection final | ||||
|     : public IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection); | ||||
| class ConnectionFromClient final | ||||
|     : public IPC::ConnectionFromClient<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient); | ||||
| 
 | ||||
| public: | ||||
|     ~ClientConnection() override; | ||||
|     ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
| 
 | ||||
|     virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer const&) override; | ||||
| }; | ||||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| namespace WebContent { | ||||
| 
 | ||||
| class ClientConnection; | ||||
| class ConnectionFromClient; | ||||
| class PageHost; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <ImageDecoder/ClientConnection.h> | ||||
| #include <ImageDecoder/ConnectionFromClient.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibIPC/SingleServer.h> | ||||
|  | @ -16,7 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
|     TRY(Core::System::pledge("stdio recvfd sendfd unix")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<ImageDecoder::ClientConnection>()); | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<ImageDecoder::ConnectionFromClient>()); | ||||
| 
 | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd")); | ||||
|     return event_loop.exec(); | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ compile_ipc(InspectorServer.ipc InspectorServerEndpoint.h) | |||
| compile_ipc(InspectorClient.ipc InspectorClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     main.cpp | ||||
|     InspectableProcess.cpp | ||||
|     InspectorServerEndpoint.h | ||||
|  |  | |||
|  | @ -6,28 +6,28 @@ | |||
| 
 | ||||
| #include "InspectableProcess.h" | ||||
| #include <AK/JsonObject.h> | ||||
| #include <InspectorServer/ClientConnection.h> | ||||
| #include <InspectorServer/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace InspectorServer { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|     : IPC::ClientConnection<InspectorClientEndpoint, InspectorServerEndpoint>(*this, move(socket), client_id) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|     : IPC::ConnectionFromClient<InspectorClientEndpoint, InspectorServerEndpoint>(*this, move(socket), client_id) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
| } | ||||
| 
 | ||||
| Messages::InspectorServer::GetAllObjectsResponse ClientConnection::get_all_objects(pid_t pid) | ||||
| Messages::InspectorServer::GetAllObjectsResponse ConnectionFromClient::get_all_objects(pid_t pid) | ||||
| { | ||||
|     auto process = InspectableProcess::from_pid(pid); | ||||
|     if (!process) | ||||
|  | @ -40,7 +40,7 @@ Messages::InspectorServer::GetAllObjectsResponse ClientConnection::get_all_objec | |||
|     return response; | ||||
| } | ||||
| 
 | ||||
| Messages::InspectorServer::SetInspectedObjectResponse ClientConnection::set_inspected_object(pid_t pid, u64 object_id) | ||||
| Messages::InspectorServer::SetInspectedObjectResponse ConnectionFromClient::set_inspected_object(pid_t pid, u64 object_id) | ||||
| { | ||||
|     auto process = InspectableProcess::from_pid(pid); | ||||
|     if (!process) | ||||
|  | @ -53,7 +53,7 @@ Messages::InspectorServer::SetInspectedObjectResponse ClientConnection::set_insp | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| Messages::InspectorServer::SetObjectPropertyResponse ClientConnection::set_object_property(pid_t pid, u64 object_id, String const& name, String const& value) | ||||
| Messages::InspectorServer::SetObjectPropertyResponse ConnectionFromClient::set_object_property(pid_t pid, u64 object_id, String const& name, String const& value) | ||||
| { | ||||
|     auto process = InspectableProcess::from_pid(pid); | ||||
|     if (!process) | ||||
|  | @ -68,7 +68,7 @@ Messages::InspectorServer::SetObjectPropertyResponse ClientConnection::set_objec | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| Messages::InspectorServer::IdentifyResponse ClientConnection::identify(pid_t pid) | ||||
| Messages::InspectorServer::IdentifyResponse ConnectionFromClient::identify(pid_t pid) | ||||
| { | ||||
|     auto process = InspectableProcess::from_pid(pid); | ||||
|     if (!process) | ||||
|  | @ -81,7 +81,7 @@ Messages::InspectorServer::IdentifyResponse ClientConnection::identify(pid_t pid | |||
|     return response; | ||||
| } | ||||
| 
 | ||||
| Messages::InspectorServer::IsInspectableResponse ClientConnection::is_inspectable(pid_t pid) | ||||
| Messages::InspectorServer::IsInspectableResponse ConnectionFromClient::is_inspectable(pid_t pid) | ||||
| { | ||||
|     auto process = InspectableProcess::from_pid(pid); | ||||
|     if (!process) | ||||
|  | @ -9,21 +9,21 @@ | |||
| #include <AK/HashMap.h> | ||||
| #include <InspectorServer/InspectorClientEndpoint.h> | ||||
| #include <InspectorServer/InspectorServerEndpoint.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace InspectorServer { | ||||
| 
 | ||||
| class ClientConnection final | ||||
|     : public IPC::ClientConnection<InspectorClientEndpoint, InspectorServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection); | ||||
| class ConnectionFromClient final | ||||
|     : public IPC::ConnectionFromClient<InspectorClientEndpoint, InspectorServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient); | ||||
| 
 | ||||
| public: | ||||
|     ~ClientConnection() override; | ||||
|     ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
| 
 | ||||
|     virtual Messages::InspectorServer::GetAllObjectsResponse get_all_objects(pid_t) override; | ||||
|     virtual Messages::InspectorServer::SetInspectedObjectResponse set_inspected_object(pid_t, u64 object_id) override; | ||||
|  | @ -8,6 +8,6 @@ | |||
| 
 | ||||
| namespace SymbolServer { | ||||
| 
 | ||||
| class ClientConnection; | ||||
| class ConnectionFromClient; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -5,11 +5,11 @@ | |||
|  */ | ||||
| 
 | ||||
| #include "InspectableProcess.h" | ||||
| #include <InspectorServer/ClientConnection.h> | ||||
| #include <InspectorServer/ConnectionFromClient.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| #include <LibIPC/MultiServer.h> | ||||
| #include <LibMain/Main.h> | ||||
| 
 | ||||
|  | @ -19,7 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
| 
 | ||||
|     TRY(Core::System::pledge("stdio unix accept")); | ||||
| 
 | ||||
|     auto server = TRY(IPC::MultiServer<InspectorServer::ClientConnection>::try_create("/tmp/portal/inspector")); | ||||
|     auto server = TRY(IPC::MultiServer<InspectorServer::ConnectionFromClient>::try_create("/tmp/portal/inspector")); | ||||
| 
 | ||||
|     auto inspectables_server = TRY(Core::LocalServer::try_create()); | ||||
|     TRY(inspectables_server->take_over_from_system_server("/tmp/portal/inspectables")); | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ compile_ipc(LaunchServer.ipc LaunchServerEndpoint.h) | |||
| compile_ipc(LaunchClient.ipc LaunchClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     Launcher.cpp | ||||
|     main.cpp | ||||
|     LaunchClientEndpoint.h | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include "Launcher.h" | ||||
| #include <AK/HashMap.h> | ||||
| #include <AK/URL.h> | ||||
|  | @ -12,23 +12,23 @@ | |||
| 
 | ||||
| namespace LaunchServer { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) | ||||
|     : IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint>(*this, move(client_socket), client_id) | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) | ||||
|     : IPC::ConnectionFromClient<LaunchClientEndpoint, LaunchServerEndpoint>(*this, move(client_socket), client_id) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
| } | ||||
| 
 | ||||
| Messages::LaunchServer::OpenUrlResponse ClientConnection::open_url(URL const& url, String const& handler_name) | ||||
| Messages::LaunchServer::OpenUrlResponse ConnectionFromClient::open_url(URL const& url, String const& handler_name) | ||||
| { | ||||
|     if (!m_allowlist.is_empty()) { | ||||
|         bool allowed = false; | ||||
|  | @ -51,17 +51,17 @@ Messages::LaunchServer::OpenUrlResponse ClientConnection::open_url(URL const& ur | |||
|     return Launcher::the().open_url(url, handler_name); | ||||
| } | ||||
| 
 | ||||
| Messages::LaunchServer::GetHandlersForUrlResponse ClientConnection::get_handlers_for_url(URL const& url) | ||||
| Messages::LaunchServer::GetHandlersForUrlResponse ConnectionFromClient::get_handlers_for_url(URL const& url) | ||||
| { | ||||
|     return Launcher::the().handlers_for_url(url); | ||||
| } | ||||
| 
 | ||||
| Messages::LaunchServer::GetHandlersWithDetailsForUrlResponse ClientConnection::get_handlers_with_details_for_url(URL const& url) | ||||
| Messages::LaunchServer::GetHandlersWithDetailsForUrlResponse ConnectionFromClient::get_handlers_with_details_for_url(URL const& url) | ||||
| { | ||||
|     return Launcher::the().handlers_with_details_for_url(url); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::add_allowed_url(URL const& url) | ||||
| void ConnectionFromClient::add_allowed_url(URL const& url) | ||||
| { | ||||
|     if (m_allowlist_is_sealed) { | ||||
|         did_misbehave("Got request to add more allowed handlers after list was sealed"); | ||||
|  | @ -76,7 +76,7 @@ void ClientConnection::add_allowed_url(URL const& url) | |||
|     m_allowlist.empend(String(), false, Vector<URL> { url }); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::add_allowed_handler_with_any_url(String const& handler_name) | ||||
| void ConnectionFromClient::add_allowed_handler_with_any_url(String const& handler_name) | ||||
| { | ||||
|     if (m_allowlist_is_sealed) { | ||||
|         did_misbehave("Got request to add more allowed handlers after list was sealed"); | ||||
|  | @ -91,7 +91,7 @@ void ClientConnection::add_allowed_handler_with_any_url(String const& handler_na | |||
|     m_allowlist.empend(handler_name, true, Vector<URL>()); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::add_allowed_handler_with_only_specific_urls(String const& handler_name, Vector<URL> const& urls) | ||||
| void ConnectionFromClient::add_allowed_handler_with_only_specific_urls(String const& handler_name, Vector<URL> const& urls) | ||||
| { | ||||
|     if (m_allowlist_is_sealed) { | ||||
|         did_misbehave("Got request to add more allowed handlers after list was sealed"); | ||||
|  | @ -111,7 +111,7 @@ void ClientConnection::add_allowed_handler_with_only_specific_urls(String const& | |||
|     m_allowlist.empend(handler_name, false, urls); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::seal_allowlist() | ||||
| void ConnectionFromClient::seal_allowlist() | ||||
| { | ||||
|     if (m_allowlist_is_sealed) { | ||||
|         did_misbehave("Got more than one request to seal the allowed handlers list"); | ||||
|  | @ -8,19 +8,19 @@ | |||
| 
 | ||||
| #include <LaunchServer/LaunchClientEndpoint.h> | ||||
| #include <LaunchServer/LaunchServerEndpoint.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| 
 | ||||
| namespace LaunchServer { | ||||
| 
 | ||||
| class ClientConnection final : public IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection) | ||||
| class ConnectionFromClient final : public IPC::ConnectionFromClient<LaunchClientEndpoint, LaunchServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient) | ||||
| public: | ||||
|     ~ClientConnection() override; | ||||
|     ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
| 
 | ||||
|     virtual Messages::LaunchServer::OpenUrlResponse open_url(URL const&, String const&) override; | ||||
|     virtual Messages::LaunchServer::GetHandlersForUrlResponse get_handlers_for_url(URL const&) override; | ||||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include "Launcher.h" | ||||
| #include <LibCore/ConfigFile.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
|  | @ -15,7 +15,7 @@ | |||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     Core::EventLoop event_loop; | ||||
|     auto server = TRY(IPC::MultiServer<LaunchServer::ClientConnection>::try_create()); | ||||
|     auto server = TRY(IPC::MultiServer<LaunchServer::ConnectionFromClient>::try_create()); | ||||
| 
 | ||||
|     auto launcher = LaunchServer::Launcher(); | ||||
|     launcher.load_handlers(); | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ set(SOURCES | |||
|     LookupServer.cpp | ||||
|     LookupServerEndpoint.h | ||||
|     LookupClientEndpoint.h | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     MulticastDNS.cpp | ||||
|     main.cpp | ||||
| ) | ||||
|  |  | |||
|  | @ -4,31 +4,31 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include "DNSPacket.h" | ||||
| #include "LookupServer.h" | ||||
| #include <AK/IPv4Address.h> | ||||
| 
 | ||||
| namespace LookupServer { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|     : IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint>(*this, move(socket), client_id) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|     : IPC::ConnectionFromClient<LookupClientEndpoint, LookupServerEndpoint>(*this, move(socket), client_id) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
| } | ||||
| 
 | ||||
| Messages::LookupServer::LookupNameResponse ClientConnection::lookup_name(String const& name) | ||||
| Messages::LookupServer::LookupNameResponse ConnectionFromClient::lookup_name(String const& name) | ||||
| { | ||||
|     auto maybe_answers = LookupServer::the().lookup(name, DNSRecordType::A); | ||||
|     if (maybe_answers.is_error()) { | ||||
|  | @ -43,7 +43,7 @@ Messages::LookupServer::LookupNameResponse ClientConnection::lookup_name(String | |||
|     return { 0, move(addresses) }; | ||||
| } | ||||
| 
 | ||||
| Messages::LookupServer::LookupAddressResponse ClientConnection::lookup_address(String const& address) | ||||
| Messages::LookupServer::LookupAddressResponse ConnectionFromClient::lookup_address(String const& address) | ||||
| { | ||||
|     if (address.length() != 4) | ||||
|         return { 1, String() }; | ||||
|  | @ -7,23 +7,23 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <AK/HashMap.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| #include <LookupServer/LookupClientEndpoint.h> | ||||
| #include <LookupServer/LookupServerEndpoint.h> | ||||
| 
 | ||||
| namespace LookupServer { | ||||
| 
 | ||||
| class ClientConnection final | ||||
|     : public IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection); | ||||
| class ConnectionFromClient final | ||||
|     : public IPC::ConnectionFromClient<LookupClientEndpoint, LookupServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient); | ||||
| 
 | ||||
| public: | ||||
|     virtual ~ClientConnection() override; | ||||
|     virtual ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
| 
 | ||||
|     virtual Messages::LookupServer::LookupNameResponse lookup_name(String const&) override; | ||||
|     virtual Messages::LookupServer::LookupAddressResponse lookup_address(String const&) override; | ||||
|  | @ -5,7 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include "LookupServer.h" | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include "DNSPacket.h" | ||||
| #include <AK/Debug.h> | ||||
| #include <AK/HashMap.h> | ||||
|  | @ -72,7 +72,7 @@ LookupServer::LookupServer() | |||
|     } | ||||
|     m_mdns = MulticastDNS::construct(this); | ||||
| 
 | ||||
|     m_server = MUST(IPC::MultiServer<ClientConnection>::try_create()); | ||||
|     m_server = MUST(IPC::MultiServer<ConnectionFromClient>::try_create()); | ||||
| } | ||||
| 
 | ||||
| void LookupServer::load_etc_hosts() | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include "DNSName.h" | ||||
| #include "DNSPacket.h" | ||||
| #include "DNSServer.h" | ||||
|  | @ -34,7 +34,7 @@ private: | |||
| 
 | ||||
|     ErrorOr<Vector<DNSAnswer>> lookup(const DNSName& hostname, const String& nameserver, bool& did_get_response, DNSRecordType record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes); | ||||
| 
 | ||||
|     OwnPtr<IPC::MultiServer<ClientConnection>> m_server; | ||||
|     OwnPtr<IPC::MultiServer<ConnectionFromClient>> m_server; | ||||
|     RefPtr<DNSServer> m_dns_server; | ||||
|     RefPtr<MulticastDNS> m_mdns; | ||||
|     Vector<String> m_nameservers; | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ compile_ipc(NotificationServer.ipc NotificationServerEndpoint.h) | |||
| compile_ipc(NotificationClient.ipc NotificationClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     main.cpp | ||||
|     NotificationWindow.cpp | ||||
|     NotificationServerEndpoint.h | ||||
|  |  | |||
|  | @ -4,37 +4,37 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include "NotificationWindow.h" | ||||
| #include <AK/HashMap.h> | ||||
| #include <NotificationServer/NotificationClientEndpoint.h> | ||||
| 
 | ||||
| namespace NotificationServer { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) | ||||
|     : IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint>(*this, move(client_socket), client_id) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) | ||||
|     : IPC::ConnectionFromClient<NotificationClientEndpoint, NotificationServerEndpoint>(*this, move(client_socket), client_id) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::show_notification(String const& text, String const& title, Gfx::ShareableBitmap const& icon) | ||||
| void ConnectionFromClient::show_notification(String const& text, String const& title, Gfx::ShareableBitmap const& icon) | ||||
| { | ||||
|     auto window = NotificationWindow::construct(client_id(), text, title, icon); | ||||
|     window->show(); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::close_notification() | ||||
| void ConnectionFromClient::close_notification() | ||||
| { | ||||
|     auto window = NotificationWindow::get_window_by_id(client_id()); | ||||
|     if (window) { | ||||
|  | @ -42,7 +42,7 @@ void ClientConnection::close_notification() | |||
|     } | ||||
| } | ||||
| 
 | ||||
| Messages::NotificationServer::UpdateNotificationIconResponse ClientConnection::update_notification_icon(Gfx::ShareableBitmap const& icon) | ||||
| Messages::NotificationServer::UpdateNotificationIconResponse ConnectionFromClient::update_notification_icon(Gfx::ShareableBitmap const& icon) | ||||
| { | ||||
|     auto window = NotificationWindow::get_window_by_id(client_id()); | ||||
|     if (window) { | ||||
|  | @ -51,7 +51,7 @@ Messages::NotificationServer::UpdateNotificationIconResponse ClientConnection::u | |||
|     return !!window; | ||||
| } | ||||
| 
 | ||||
| Messages::NotificationServer::UpdateNotificationTextResponse ClientConnection::update_notification_text(String const& text, String const& title) | ||||
| Messages::NotificationServer::UpdateNotificationTextResponse ConnectionFromClient::update_notification_text(String const& text, String const& title) | ||||
| { | ||||
|     auto window = NotificationWindow::get_window_by_id(client_id()); | ||||
|     if (window) { | ||||
|  | @ -61,7 +61,7 @@ Messages::NotificationServer::UpdateNotificationTextResponse ClientConnection::u | |||
|     return !!window; | ||||
| } | ||||
| 
 | ||||
| Messages::NotificationServer::IsShowingResponse ClientConnection::is_showing() | ||||
| Messages::NotificationServer::IsShowingResponse ConnectionFromClient::is_showing() | ||||
| { | ||||
|     auto window = NotificationWindow::get_window_by_id(client_id()); | ||||
|     return !!window; | ||||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| #include <WindowServer/ScreenLayout.h> | ||||
| 
 | ||||
| // Must be included after WindowServer/ScreenLayout.h
 | ||||
|  | @ -15,15 +15,15 @@ | |||
| 
 | ||||
| namespace NotificationServer { | ||||
| 
 | ||||
| class ClientConnection final : public IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection) | ||||
| class ConnectionFromClient final : public IPC::ConnectionFromClient<NotificationClientEndpoint, NotificationServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient) | ||||
| public: | ||||
|     ~ClientConnection() override; | ||||
|     ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
| 
 | ||||
|     virtual void show_notification(String const&, String const&, Gfx::ShareableBitmap const&) override; | ||||
|     virtual void close_notification() override; | ||||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include "ClientConnection.h" | ||||
| #include "ConnectionFromClient.h" | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibIPC/MultiServer.h> | ||||
|  | @ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
|     TRY(Core::System::pledge("stdio recvfd sendfd accept rpath unix")); | ||||
| 
 | ||||
|     auto app = TRY(GUI::Application::try_create(arguments)); | ||||
|     auto server = TRY(IPC::MultiServer<NotificationServer::ClientConnection>::try_create()); | ||||
|     auto server = TRY(IPC::MultiServer<NotificationServer::ConnectionFromClient>::try_create()); | ||||
| 
 | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ compile_ipc(RequestServer.ipc RequestServerEndpoint.h) | |||
| compile_ipc(RequestClient.ipc RequestClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     ConnectionCache.cpp | ||||
|     Request.cpp | ||||
|     RequestClientEndpoint.h | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <AK/Badge.h> | ||||
| #include <RequestServer/ClientConnection.h> | ||||
| #include <RequestServer/ConnectionFromClient.h> | ||||
| #include <RequestServer/Protocol.h> | ||||
| #include <RequestServer/Request.h> | ||||
| #include <RequestServer/RequestClientEndpoint.h> | ||||
|  | @ -13,32 +13,32 @@ | |||
| 
 | ||||
| namespace RequestServer { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|     : IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint>(*this, move(socket), 1) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) | ||||
|     : IPC::ConnectionFromClient<RequestClientEndpoint, RequestServerEndpoint>(*this, move(socket), 1) | ||||
| { | ||||
|     s_connections.set(1, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
|     if (s_connections.is_empty()) | ||||
|         Core::EventLoop::current().quit(0); | ||||
| } | ||||
| 
 | ||||
| Messages::RequestServer::IsSupportedProtocolResponse ClientConnection::is_supported_protocol(String const& protocol) | ||||
| Messages::RequestServer::IsSupportedProtocolResponse ConnectionFromClient::is_supported_protocol(String const& protocol) | ||||
| { | ||||
|     bool supported = Protocol::find_by_name(protocol.to_lowercase()); | ||||
|     return supported; | ||||
| } | ||||
| 
 | ||||
| Messages::RequestServer::StartRequestResponse ClientConnection::start_request(String const& method, URL const& url, IPC::Dictionary const& request_headers, ByteBuffer const& request_body) | ||||
| Messages::RequestServer::StartRequestResponse ConnectionFromClient::start_request(String const& method, URL const& url, IPC::Dictionary const& request_headers, ByteBuffer const& request_body) | ||||
| { | ||||
|     if (!url.is_valid()) { | ||||
|         dbgln("StartRequest: Invalid URL requested: '{}'", url); | ||||
|  | @ -60,7 +60,7 @@ Messages::RequestServer::StartRequestResponse ClientConnection::start_request(St | |||
|     return { id, IPC::File(fd, IPC::File::CloseAfterSending) }; | ||||
| } | ||||
| 
 | ||||
| Messages::RequestServer::StopRequestResponse ClientConnection::stop_request(i32 request_id) | ||||
| Messages::RequestServer::StopRequestResponse ConnectionFromClient::stop_request(i32 request_id) | ||||
| { | ||||
|     auto* request = const_cast<Request*>(m_requests.get(request_id).value_or(nullptr)); | ||||
|     bool success = false; | ||||
|  | @ -72,7 +72,7 @@ Messages::RequestServer::StopRequestResponse ClientConnection::stop_request(i32 | |||
|     return success; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::did_receive_headers(Badge<Request>, Request& request) | ||||
| void ConnectionFromClient::did_receive_headers(Badge<Request>, Request& request) | ||||
| { | ||||
|     IPC::Dictionary response_headers; | ||||
|     for (auto& it : request.response_headers()) | ||||
|  | @ -81,7 +81,7 @@ void ClientConnection::did_receive_headers(Badge<Request>, Request& request) | |||
|     async_headers_became_available(request.id(), move(response_headers), request.status_code()); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::did_finish_request(Badge<Request>, Request& request, bool success) | ||||
| void ConnectionFromClient::did_finish_request(Badge<Request>, Request& request, bool success) | ||||
| { | ||||
|     VERIFY(request.total_size().has_value()); | ||||
| 
 | ||||
|  | @ -90,17 +90,17 @@ void ClientConnection::did_finish_request(Badge<Request>, Request& request, bool | |||
|     m_requests.remove(request.id()); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::did_progress_request(Badge<Request>, Request& request) | ||||
| void ConnectionFromClient::did_progress_request(Badge<Request>, Request& request) | ||||
| { | ||||
|     async_request_progress(request.id(), request.total_size(), request.downloaded_size()); | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::did_request_certificates(Badge<Request>, Request& request) | ||||
| void ConnectionFromClient::did_request_certificates(Badge<Request>, Request& request) | ||||
| { | ||||
|     async_certificate_requested(request.id()); | ||||
| } | ||||
| 
 | ||||
| Messages::RequestServer::SetCertificateResponse ClientConnection::set_certificate(i32 request_id, String const& certificate, String const& key) | ||||
| Messages::RequestServer::SetCertificateResponse ConnectionFromClient::set_certificate(i32 request_id, String const& certificate, String const& key) | ||||
| { | ||||
|     auto* request = const_cast<Request*>(m_requests.get(request_id).value_or(nullptr)); | ||||
|     bool success = false; | ||||
|  | @ -111,7 +111,7 @@ Messages::RequestServer::SetCertificateResponse ClientConnection::set_certificat | |||
|     return success; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::ensure_connection(URL const& url, ::RequestServer::CacheLevel const& cache_level) | ||||
| void ConnectionFromClient::ensure_connection(URL const& url, ::RequestServer::CacheLevel const& cache_level) | ||||
| { | ||||
|     if (!url.is_valid()) { | ||||
|         dbgln("EnsureConnection: Invalid URL requested: '{}'", url); | ||||
|  | @ -7,19 +7,19 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <AK/HashMap.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| #include <RequestServer/Forward.h> | ||||
| #include <RequestServer/RequestClientEndpoint.h> | ||||
| #include <RequestServer/RequestServerEndpoint.h> | ||||
| 
 | ||||
| namespace RequestServer { | ||||
| 
 | ||||
| class ClientConnection final | ||||
|     : public IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection); | ||||
| class ConnectionFromClient final | ||||
|     : public IPC::ConnectionFromClient<RequestClientEndpoint, RequestServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient); | ||||
| 
 | ||||
| public: | ||||
|     ~ClientConnection() override; | ||||
|     ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
|  | @ -29,7 +29,7 @@ public: | |||
|     void did_request_certificates(Badge<Request>, Request&); | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); | ||||
| 
 | ||||
|     virtual Messages::RequestServer::IsSupportedProtocolResponse is_supported_protocol(String const&) override; | ||||
|     virtual Messages::RequestServer::StartRequestResponse start_request(String const&, URL const&, IPC::Dictionary const&, ByteBuffer const&) override; | ||||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| namespace RequestServer { | ||||
| 
 | ||||
| class ClientConnection; | ||||
| class ConnectionFromClient; | ||||
| class Request; | ||||
| class GeminiProtocol; | ||||
| class HttpRequest; | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ GeminiProtocol::~GeminiProtocol() | |||
| { | ||||
| } | ||||
| 
 | ||||
| OwnPtr<Request> GeminiProtocol::start_request(ClientConnection& client, const String&, const URL& url, const HashMap<String, String>&, ReadonlyBytes) | ||||
| OwnPtr<Request> GeminiProtocol::start_request(ConnectionFromClient& client, const String&, const URL& url, const HashMap<String, String>&, ReadonlyBytes) | ||||
| { | ||||
|     Gemini::GeminiRequest request; | ||||
|     request.set_url(url); | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ public: | |||
|     GeminiProtocol(); | ||||
|     virtual ~GeminiProtocol() override; | ||||
| 
 | ||||
|     virtual OwnPtr<Request> start_request(ClientConnection&, const String& method, const URL&, const HashMap<String, String>&, ReadonlyBytes body) override; | ||||
|     virtual OwnPtr<Request> start_request(ConnectionFromClient&, const String& method, const URL&, const HashMap<String, String>&, ReadonlyBytes body) override; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
| 
 | ||||
| namespace RequestServer { | ||||
| 
 | ||||
| GeminiRequest::GeminiRequest(ClientConnection& client, NonnullRefPtr<Gemini::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| GeminiRequest::GeminiRequest(ConnectionFromClient& client, NonnullRefPtr<Gemini::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
|     : Request(client, move(output_stream)) | ||||
|     , m_job(move(job)) | ||||
| { | ||||
|  | @ -57,7 +57,7 @@ GeminiRequest::~GeminiRequest() | |||
|     m_job->cancel(); | ||||
| } | ||||
| 
 | ||||
| NonnullOwnPtr<GeminiRequest> GeminiRequest::create_with_job(Badge<GeminiProtocol>, ClientConnection& client, NonnullRefPtr<Gemini::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| NonnullOwnPtr<GeminiRequest> GeminiRequest::create_with_job(Badge<GeminiProtocol>, ConnectionFromClient& client, NonnullRefPtr<Gemini::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| { | ||||
|     return adopt_own(*new GeminiRequest(client, move(job), move(output_stream))); | ||||
| } | ||||
|  |  | |||
|  | @ -16,14 +16,14 @@ namespace RequestServer { | |||
| class GeminiRequest final : public Request { | ||||
| public: | ||||
|     virtual ~GeminiRequest() override; | ||||
|     static NonnullOwnPtr<GeminiRequest> create_with_job(Badge<GeminiProtocol>, ClientConnection&, NonnullRefPtr<Gemini::Job>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
|     static NonnullOwnPtr<GeminiRequest> create_with_job(Badge<GeminiProtocol>, ConnectionFromClient&, NonnullRefPtr<Gemini::Job>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
| 
 | ||||
|     Gemini::Job const& job() const { return *m_job; } | ||||
| 
 | ||||
|     virtual URL url() const override { return m_job->url(); } | ||||
| 
 | ||||
| private: | ||||
|     explicit GeminiRequest(ClientConnection&, NonnullRefPtr<Gemini::Job>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
|     explicit GeminiRequest(ConnectionFromClient&, NonnullRefPtr<Gemini::Job>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
| 
 | ||||
|     virtual void set_certificate(String certificate, String key) override; | ||||
| 
 | ||||
|  |  | |||
|  | @ -14,8 +14,8 @@ | |||
| #include <AK/String.h> | ||||
| #include <AK/Types.h> | ||||
| #include <LibHTTP/HttpRequest.h> | ||||
| #include <RequestServer/ClientConnection.h> | ||||
| #include <RequestServer/ConnectionCache.h> | ||||
| #include <RequestServer/ConnectionFromClient.h> | ||||
| #include <RequestServer/Request.h> | ||||
| 
 | ||||
| namespace RequestServer::Detail { | ||||
|  | @ -61,7 +61,7 @@ void init(TSelf* self, TJob job) | |||
| } | ||||
| 
 | ||||
| template<typename TBadgedProtocol, typename TPipeResult> | ||||
| OwnPtr<Request> start_request(TBadgedProtocol&& protocol, ClientConnection& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body, TPipeResult&& pipe_result) | ||||
| OwnPtr<Request> start_request(TBadgedProtocol&& protocol, ConnectionFromClient& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body, TPipeResult&& pipe_result) | ||||
| { | ||||
|     using TJob = typename TBadgedProtocol::Type::JobType; | ||||
|     using TRequest = typename TBadgedProtocol::Type::RequestType; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| #include <AK/OwnPtr.h> | ||||
| #include <AK/String.h> | ||||
| #include <AK/URL.h> | ||||
| #include <RequestServer/ClientConnection.h> | ||||
| #include <RequestServer/ConnectionFromClient.h> | ||||
| #include <RequestServer/HttpCommon.h> | ||||
| #include <RequestServer/HttpProtocol.h> | ||||
| #include <RequestServer/Request.h> | ||||
|  | @ -22,7 +22,7 @@ HttpProtocol::HttpProtocol() | |||
| { | ||||
| } | ||||
| 
 | ||||
| OwnPtr<Request> HttpProtocol::start_request(ClientConnection& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body) | ||||
| OwnPtr<Request> HttpProtocol::start_request(ConnectionFromClient& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body) | ||||
| { | ||||
|     return Detail::start_request(Badge<HttpProtocol> {}, client, method, url, headers, body, get_pipe_for_request()); | ||||
| } | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
| #include <AK/String.h> | ||||
| #include <AK/URL.h> | ||||
| #include <LibHTTP/Job.h> | ||||
| #include <RequestServer/ClientConnection.h> | ||||
| #include <RequestServer/ConnectionFromClient.h> | ||||
| #include <RequestServer/HttpRequest.h> | ||||
| #include <RequestServer/Protocol.h> | ||||
| #include <RequestServer/Request.h> | ||||
|  | @ -27,7 +27,7 @@ public: | |||
|     HttpProtocol(); | ||||
|     ~HttpProtocol() override = default; | ||||
| 
 | ||||
|     virtual OwnPtr<Request> start_request(ClientConnection&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) override; | ||||
|     virtual OwnPtr<Request> start_request(ConnectionFromClient&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) override; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ | |||
| 
 | ||||
| namespace RequestServer { | ||||
| 
 | ||||
| HttpRequest::HttpRequest(ClientConnection& client, NonnullRefPtr<HTTP::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| HttpRequest::HttpRequest(ConnectionFromClient& client, NonnullRefPtr<HTTP::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
|     : Request(client, move(output_stream)) | ||||
|     , m_job(job) | ||||
| { | ||||
|  | @ -25,7 +25,7 @@ HttpRequest::~HttpRequest() | |||
|     m_job->cancel(); | ||||
| } | ||||
| 
 | ||||
| NonnullOwnPtr<HttpRequest> HttpRequest::create_with_job(Badge<HttpProtocol>&&, ClientConnection& client, NonnullRefPtr<HTTP::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| NonnullOwnPtr<HttpRequest> HttpRequest::create_with_job(Badge<HttpProtocol>&&, ConnectionFromClient& client, NonnullRefPtr<HTTP::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| { | ||||
|     return adopt_own(*new HttpRequest(client, move(job), move(output_stream))); | ||||
| } | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ namespace RequestServer { | |||
| class HttpRequest final : public Request { | ||||
| public: | ||||
|     virtual ~HttpRequest() override; | ||||
|     static NonnullOwnPtr<HttpRequest> create_with_job(Badge<HttpProtocol>&&, ClientConnection&, NonnullRefPtr<HTTP::Job>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
|     static NonnullOwnPtr<HttpRequest> create_with_job(Badge<HttpProtocol>&&, ConnectionFromClient&, NonnullRefPtr<HTTP::Job>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
| 
 | ||||
|     HTTP::Job& job() { return m_job; } | ||||
|     HTTP::Job const& job() const { return m_job; } | ||||
|  | @ -25,7 +25,7 @@ public: | |||
|     virtual URL url() const override { return m_job->url(); } | ||||
| 
 | ||||
| private: | ||||
|     explicit HttpRequest(ClientConnection&, NonnullRefPtr<HTTP::Job>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
|     explicit HttpRequest(ConnectionFromClient&, NonnullRefPtr<HTTP::Job>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
| 
 | ||||
|     NonnullRefPtr<HTTP::Job> m_job; | ||||
| }; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| #include <AK/OwnPtr.h> | ||||
| #include <AK/String.h> | ||||
| #include <AK/URL.h> | ||||
| #include <RequestServer/ClientConnection.h> | ||||
| #include <RequestServer/ConnectionFromClient.h> | ||||
| #include <RequestServer/HttpCommon.h> | ||||
| #include <RequestServer/HttpsProtocol.h> | ||||
| #include <RequestServer/Request.h> | ||||
|  | @ -22,7 +22,7 @@ HttpsProtocol::HttpsProtocol() | |||
| { | ||||
| } | ||||
| 
 | ||||
| OwnPtr<Request> HttpsProtocol::start_request(ClientConnection& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body) | ||||
| OwnPtr<Request> HttpsProtocol::start_request(ConnectionFromClient& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body) | ||||
| { | ||||
|     return Detail::start_request(Badge<HttpsProtocol> {}, client, method, url, headers, body, get_pipe_for_request()); | ||||
| } | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
| #include <AK/String.h> | ||||
| #include <AK/URL.h> | ||||
| #include <LibHTTP/HttpsJob.h> | ||||
| #include <RequestServer/ClientConnection.h> | ||||
| #include <RequestServer/ConnectionFromClient.h> | ||||
| #include <RequestServer/HttpsRequest.h> | ||||
| #include <RequestServer/Protocol.h> | ||||
| #include <RequestServer/Request.h> | ||||
|  | @ -27,7 +27,7 @@ public: | |||
|     HttpsProtocol(); | ||||
|     ~HttpsProtocol() override = default; | ||||
| 
 | ||||
|     virtual OwnPtr<Request> start_request(ClientConnection&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) override; | ||||
|     virtual OwnPtr<Request> start_request(ConnectionFromClient&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) override; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ | |||
| 
 | ||||
| namespace RequestServer { | ||||
| 
 | ||||
| HttpsRequest::HttpsRequest(ClientConnection& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| HttpsRequest::HttpsRequest(ConnectionFromClient& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
|     : Request(client, move(output_stream)) | ||||
|     , m_job(job) | ||||
| { | ||||
|  | @ -30,7 +30,7 @@ HttpsRequest::~HttpsRequest() | |||
|     m_job->cancel(); | ||||
| } | ||||
| 
 | ||||
| NonnullOwnPtr<HttpsRequest> HttpsRequest::create_with_job(Badge<HttpsProtocol>&&, ClientConnection& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| NonnullOwnPtr<HttpsRequest> HttpsRequest::create_with_job(Badge<HttpsProtocol>&&, ConnectionFromClient& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| { | ||||
|     return adopt_own(*new HttpsRequest(client, move(job), move(output_stream))); | ||||
| } | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ namespace RequestServer { | |||
| class HttpsRequest final : public Request { | ||||
| public: | ||||
|     virtual ~HttpsRequest() override; | ||||
|     static NonnullOwnPtr<HttpsRequest> create_with_job(Badge<HttpsProtocol>&&, ClientConnection&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
|     static NonnullOwnPtr<HttpsRequest> create_with_job(Badge<HttpsProtocol>&&, ConnectionFromClient&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
| 
 | ||||
|     HTTP::HttpsJob& job() { return m_job; } | ||||
|     HTTP::HttpsJob const& job() const { return m_job; } | ||||
|  | @ -24,7 +24,7 @@ public: | |||
|     virtual URL url() const override { return m_job->url(); } | ||||
| 
 | ||||
| private: | ||||
|     explicit HttpsRequest(ClientConnection&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
|     explicit HttpsRequest(ConnectionFromClient&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<Core::Stream::File>&&); | ||||
| 
 | ||||
|     virtual void set_certificate(String certificate, String key) override; | ||||
| 
 | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ public: | |||
|     virtual ~Protocol(); | ||||
| 
 | ||||
|     const String& name() const { return m_name; } | ||||
|     virtual OwnPtr<Request> start_request(ClientConnection&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) = 0; | ||||
|     virtual OwnPtr<Request> start_request(ConnectionFromClient&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) = 0; | ||||
| 
 | ||||
|     static Protocol* find_by_name(const String&); | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <RequestServer/ClientConnection.h> | ||||
| #include <RequestServer/ConnectionFromClient.h> | ||||
| #include <RequestServer/Request.h> | ||||
| 
 | ||||
| namespace RequestServer { | ||||
|  | @ -12,7 +12,7 @@ namespace RequestServer { | |||
| // FIXME: What about rollover?
 | ||||
| static i32 s_next_id = 1; | ||||
| 
 | ||||
| Request::Request(ClientConnection& client, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
| Request::Request(ConnectionFromClient& client, NonnullOwnPtr<Core::Stream::File>&& output_stream) | ||||
|     : m_client(client) | ||||
|     , m_id(s_next_id++) | ||||
|     , m_output_stream(move(output_stream)) | ||||
|  |  | |||
|  | @ -44,10 +44,10 @@ public: | |||
|     const Core::Stream::File& output_stream() const { return *m_output_stream; } | ||||
| 
 | ||||
| protected: | ||||
|     explicit Request(ClientConnection&, NonnullOwnPtr<Core::Stream::File>&&); | ||||
|     explicit Request(ConnectionFromClient&, NonnullOwnPtr<Core::Stream::File>&&); | ||||
| 
 | ||||
| private: | ||||
|     ClientConnection& m_client; | ||||
|     ConnectionFromClient& m_client; | ||||
|     i32 m_id { 0 }; | ||||
|     int m_request_fd { -1 }; // Passed to client.
 | ||||
|     Optional<u32> m_status_code; | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ | |||
| #include <LibIPC/SingleServer.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibTLS/Certificate.h> | ||||
| #include <RequestServer/ClientConnection.h> | ||||
| #include <RequestServer/ConnectionFromClient.h> | ||||
| #include <RequestServer/GeminiProtocol.h> | ||||
| #include <RequestServer/HttpProtocol.h> | ||||
| #include <RequestServer/HttpsProtocol.h> | ||||
|  | @ -46,7 +46,7 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
|     [[maybe_unused]] auto http = make<RequestServer::HttpProtocol>(); | ||||
|     [[maybe_unused]] auto https = make<RequestServer::HttpsProtocol>(); | ||||
| 
 | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<RequestServer::ClientConnection>()); | ||||
|     auto client = TRY(IPC::take_over_accepted_client_from_system_server<RequestServer::ConnectionFromClient>()); | ||||
| 
 | ||||
|     auto result = event_loop.exec(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ compile_ipc(SQLServer.ipc SQLServerEndpoint.h) | |||
| compile_ipc(SQLClient.ipc SQLClientEndpoint.h) | ||||
| 
 | ||||
| set(SOURCES | ||||
|     ClientConnection.cpp | ||||
|     ConnectionFromClient.cpp | ||||
|     DatabaseConnection.cpp | ||||
|     main.cpp | ||||
|     SQLClientEndpoint.h | ||||
|  |  | |||
|  | @ -7,15 +7,15 @@ | |||
| #include <AK/String.h> | ||||
| #include <AK/Vector.h> | ||||
| #include <LibSQL/Result.h> | ||||
| #include <SQLServer/ClientConnection.h> | ||||
| #include <SQLServer/ConnectionFromClient.h> | ||||
| #include <SQLServer/DatabaseConnection.h> | ||||
| #include <SQLServer/SQLStatement.h> | ||||
| 
 | ||||
| namespace SQLServer { | ||||
| 
 | ||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||
| static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; | ||||
| 
 | ||||
| RefPtr<ClientConnection> ClientConnection::client_connection_for(int client_id) | ||||
| RefPtr<ConnectionFromClient> ConnectionFromClient::client_connection_for(int client_id) | ||||
| { | ||||
|     if (s_connections.contains(client_id)) | ||||
|         return *s_connections.get(client_id).value(); | ||||
|  | @ -23,31 +23,31 @@ RefPtr<ClientConnection> ClientConnection::client_connection_for(int client_id) | |||
|     return nullptr; | ||||
| } | ||||
| 
 | ||||
| ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|     : IPC::ClientConnection<SQLClientEndpoint, SQLServerEndpoint>(*this, move(socket), client_id) | ||||
| ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) | ||||
|     : IPC::ConnectionFromClient<SQLClientEndpoint, SQLServerEndpoint>(*this, move(socket), client_id) | ||||
| { | ||||
|     s_connections.set(client_id, *this); | ||||
| } | ||||
| 
 | ||||
| ClientConnection::~ClientConnection() | ||||
| ConnectionFromClient::~ConnectionFromClient() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::die() | ||||
| void ConnectionFromClient::die() | ||||
| { | ||||
|     s_connections.remove(client_id()); | ||||
| } | ||||
| 
 | ||||
| Messages::SQLServer::ConnectResponse ClientConnection::connect(String const& database_name) | ||||
| Messages::SQLServer::ConnectResponse ConnectionFromClient::connect(String const& database_name) | ||||
| { | ||||
|     dbgln_if(SQLSERVER_DEBUG, "ClientConnection::connect(database_name: {})", database_name); | ||||
|     dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::connect(database_name: {})", database_name); | ||||
|     auto database_connection = DatabaseConnection::construct(database_name, client_id()); | ||||
|     return { database_connection->connection_id() }; | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::disconnect(int connection_id) | ||||
| void ConnectionFromClient::disconnect(int connection_id) | ||||
| { | ||||
|     dbgln_if(SQLSERVER_DEBUG, "ClientConnection::disconnect(connection_id: {})", connection_id); | ||||
|     dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::disconnect(connection_id: {})", connection_id); | ||||
|     auto database_connection = DatabaseConnection::connection_for(connection_id); | ||||
|     if (database_connection) | ||||
|         database_connection->disconnect(); | ||||
|  | @ -55,13 +55,13 @@ void ClientConnection::disconnect(int connection_id) | |||
|         dbgln("Database connection has disappeared"); | ||||
| } | ||||
| 
 | ||||
| Messages::SQLServer::SqlStatementResponse ClientConnection::sql_statement(int connection_id, String const& sql) | ||||
| Messages::SQLServer::SqlStatementResponse ConnectionFromClient::sql_statement(int connection_id, String const& sql) | ||||
| { | ||||
|     dbgln_if(SQLSERVER_DEBUG, "ClientConnection::sql_statement(connection_id: {}, sql: '{}')", connection_id, sql); | ||||
|     dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::sql_statement(connection_id: {}, sql: '{}')", connection_id, sql); | ||||
|     auto database_connection = DatabaseConnection::connection_for(connection_id); | ||||
|     if (database_connection) { | ||||
|         auto statement_id = database_connection->sql_statement(sql); | ||||
|         dbgln_if(SQLSERVER_DEBUG, "ClientConnection::sql_statement -> statement_id = {}", statement_id); | ||||
|         dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::sql_statement -> statement_id = {}", statement_id); | ||||
|         return { statement_id }; | ||||
|     } else { | ||||
|         dbgln("Database connection has disappeared"); | ||||
|  | @ -69,9 +69,9 @@ Messages::SQLServer::SqlStatementResponse ClientConnection::sql_statement(int co | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::statement_execute(int statement_id) | ||||
| void ConnectionFromClient::statement_execute(int statement_id) | ||||
| { | ||||
|     dbgln_if(SQLSERVER_DEBUG, "ClientConnection::statement_execute_query(statement_id: {})", statement_id); | ||||
|     dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::statement_execute_query(statement_id: {})", statement_id); | ||||
|     auto statement = SQLStatement::statement_for(statement_id); | ||||
|     if (statement && statement->connection()->client_id() == client_id()) { | ||||
|         statement->execute(); | ||||
|  | @ -7,25 +7,25 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <AK/HashMap.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibIPC/ConnectionFromClient.h> | ||||
| #include <SQLServer/SQLClientEndpoint.h> | ||||
| #include <SQLServer/SQLServerEndpoint.h> | ||||
| 
 | ||||
| namespace SQLServer { | ||||
| 
 | ||||
| class ClientConnection final | ||||
|     : public IPC::ClientConnection<SQLClientEndpoint, SQLServerEndpoint> { | ||||
|     C_OBJECT(ClientConnection); | ||||
| class ConnectionFromClient final | ||||
|     : public IPC::ConnectionFromClient<SQLClientEndpoint, SQLServerEndpoint> { | ||||
|     C_OBJECT(ConnectionFromClient); | ||||
| 
 | ||||
| public: | ||||
|     virtual ~ClientConnection() override; | ||||
|     virtual ~ConnectionFromClient() override; | ||||
| 
 | ||||
|     virtual void die() override; | ||||
| 
 | ||||
|     static RefPtr<ClientConnection> client_connection_for(int client_id); | ||||
|     static RefPtr<ConnectionFromClient> client_connection_for(int client_id); | ||||
| 
 | ||||
| private: | ||||
|     explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
|     explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); | ||||
| 
 | ||||
|     virtual Messages::SQLServer::ConnectResponse connect(String const&) override; | ||||
|     virtual Messages::SQLServer::SqlStatementResponse sql_statement(int, String const&) override; | ||||
|  | @ -5,7 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <AK/LexicalPath.h> | ||||
| #include <SQLServer/ClientConnection.h> | ||||
| #include <SQLServer/ConnectionFromClient.h> | ||||
| #include <SQLServer/DatabaseConnection.h> | ||||
| #include <SQLServer/SQLStatement.h> | ||||
| 
 | ||||
|  | @ -30,7 +30,7 @@ DatabaseConnection::DatabaseConnection(String database_name, int client_id) | |||
|     , m_client_id(client_id) | ||||
| { | ||||
|     if (LexicalPath path(m_database_name); (path.title() != m_database_name) || (path.dirname() != ".")) { | ||||
|         auto client_connection = ClientConnection::client_connection_for(m_client_id); | ||||
|         auto client_connection = ConnectionFromClient::client_connection_for(m_client_id); | ||||
|         client_connection->async_connection_error(m_connection_id, (int)SQL::SQLErrorCode::InvalidDatabaseName, m_database_name); | ||||
|         return; | ||||
|     } | ||||
|  | @ -39,7 +39,7 @@ DatabaseConnection::DatabaseConnection(String database_name, int client_id) | |||
|     s_connections.set(m_connection_id, *this); | ||||
|     deferred_invoke([this]() { | ||||
|         m_database = SQL::Database::construct(String::formatted("/home/anon/sql/{}.db", m_database_name)); | ||||
|         auto client_connection = ClientConnection::client_connection_for(m_client_id); | ||||
|         auto client_connection = ConnectionFromClient::client_connection_for(m_client_id); | ||||
|         if (auto maybe_error = m_database->open(); maybe_error.is_error()) { | ||||
|             client_connection->async_connection_error(m_connection_id, (int)SQL::SQLErrorCode::InternalError, maybe_error.error().string_literal()); | ||||
|             return; | ||||
|  | @ -59,7 +59,7 @@ void DatabaseConnection::disconnect() | |||
|     deferred_invoke([this]() { | ||||
|         m_database = nullptr; | ||||
|         s_connections.remove(m_connection_id); | ||||
|         auto client_connection = ClientConnection::client_connection_for(client_id()); | ||||
|         auto client_connection = ConnectionFromClient::client_connection_for(client_id()); | ||||
|         if (client_connection) | ||||
|             client_connection->async_disconnected(m_connection_id); | ||||
|         else | ||||
|  | @ -70,7 +70,7 @@ void DatabaseConnection::disconnect() | |||
| int DatabaseConnection::sql_statement(String const& sql) | ||||
| { | ||||
|     dbgln_if(SQLSERVER_DEBUG, "DatabaseConnection::sql_statement(connection_id {}, database '{}', sql '{}'", connection_id(), m_database_name, sql); | ||||
|     auto client_connection = ClientConnection::client_connection_for(client_id()); | ||||
|     auto client_connection = ConnectionFromClient::client_connection_for(client_id()); | ||||
|     if (!client_connection) { | ||||
|         warnln("Cannot notify client of database disconnection. Client disconnected"); | ||||
|         return -1; | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| #pragma once | ||||
| 
 | ||||
| namespace SQLServer { | ||||
| class ClientConnection; | ||||
| class ConnectionFromClient; | ||||
| class DatabaseConnection; | ||||
| class SQLStatement; | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #include <LibCore/Object.h> | ||||
| #include <LibSQL/AST/Parser.h> | ||||
| #include <SQLServer/ClientConnection.h> | ||||
| #include <SQLServer/ConnectionFromClient.h> | ||||
| #include <SQLServer/DatabaseConnection.h> | ||||
| #include <SQLServer/SQLStatement.h> | ||||
| 
 | ||||
|  | @ -37,7 +37,7 @@ void SQLStatement::report_error(SQL::Result result) | |||
| { | ||||
|     dbgln_if(SQLSERVER_DEBUG, "SQLStatement::report_error(statement_id {}, error {}", statement_id(), result.error_string()); | ||||
| 
 | ||||
|     auto client_connection = ClientConnection::client_connection_for(connection()->client_id()); | ||||
|     auto client_connection = ConnectionFromClient::client_connection_for(connection()->client_id()); | ||||
| 
 | ||||
|     s_statements.remove(statement_id()); | ||||
|     remove_from_parent(); | ||||
|  | @ -54,7 +54,7 @@ void SQLStatement::report_error(SQL::Result result) | |||
| void SQLStatement::execute() | ||||
| { | ||||
|     dbgln_if(SQLSERVER_DEBUG, "SQLStatement::execute(statement_id {}", statement_id()); | ||||
|     auto client_connection = ClientConnection::client_connection_for(connection()->client_id()); | ||||
|     auto client_connection = ConnectionFromClient::client_connection_for(connection()->client_id()); | ||||
|     if (!client_connection) { | ||||
|         warnln("Cannot yield next result. Client disconnected"); | ||||
|         return; | ||||
|  | @ -75,7 +75,7 @@ void SQLStatement::execute() | |||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         auto client_connection = ClientConnection::client_connection_for(connection()->client_id()); | ||||
|         auto client_connection = ConnectionFromClient::client_connection_for(connection()->client_id()); | ||||
|         if (!client_connection) { | ||||
|             warnln("Cannot return statement execution results. Client disconnected"); | ||||
|             return; | ||||
|  | @ -122,7 +122,7 @@ bool SQLStatement::should_send_result_rows() const | |||
| void SQLStatement::next() | ||||
| { | ||||
|     VERIFY(!m_result->is_empty()); | ||||
|     auto client_connection = ClientConnection::client_connection_for(connection()->client_id()); | ||||
|     auto client_connection = ConnectionFromClient::client_connection_for(connection()->client_id()); | ||||
|     if (!client_connection) { | ||||
|         warnln("Cannot yield next result. Client disconnected"); | ||||
|         return; | ||||
|  |  | |||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Itamar
						Itamar