From f0dad0f04e41500567ed31ceed2aeecc05f0ef6d Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 16 Sep 2024 10:58:03 +0300 Subject: [PATCH] add comments, enshort namespaces --- src/app/browser/main/tab/page.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/app/browser/main/tab/page.cpp b/src/app/browser/main/tab/page.cpp index 6094cc40..ccbfd5dd 100644 --- a/src/app/browser/main/tab/page.cpp +++ b/src/app/browser/main/tab/page.cpp @@ -629,6 +629,12 @@ sqlite3_int64 Page::DB::SESSION::add( } // Socket tools + +/* + * Private helper to build socket client connections + * + * Includes common preset used for all protocols in Page::Socket::Client class + */ Glib::RefPtr Page::Socket::Client::create( const int & TIMEOUT ) { @@ -641,9 +647,14 @@ Glib::RefPtr Page::Socket::Client::create( return CLIENT; } +/* + * Create and return socket client for Gemini protocol + * + * https://geminiprotocol.net/docs/protocol-specification.gmi + */ Glib::RefPtr Page::Socket::Client::Gemini::create() { - const auto GEMINI_CLIENT = Page::Socket::Client::create(); + const auto GEMINI_CLIENT = create(); GEMINI_CLIENT->set_tls( true @@ -660,16 +671,24 @@ Glib::RefPtr Page::Socket::Client::Gemini::create() return GEMINI_CLIENT; } +/* + * Check socket connection active according to page class implementation + */ bool Page::Socket::Connection::is_active( const Glib::RefPtr & CONNECTION ) { return CONNECTION != nullptr && CONNECTION->is_connected(); } +/* + * Close socket, make &connection nullptr + * + * return true on success or false if connection not active + */ bool Page::Socket::Connection::close( Glib::RefPtr & connection ) { - if (Socket::Connection::is_active(connection)) + if (is_active(connection)) { if (connection->close()) {