add comments, enshort namespaces

This commit is contained in:
yggverse 2024-09-16 10:58:03 +03:00
parent 81c9ae2fc8
commit f0dad0f04e

View File

@ -629,6 +629,12 @@ sqlite3_int64 Page::DB::SESSION::add(
} }
// Socket tools // Socket tools
/*
* Private helper to build socket client connections
*
* Includes common preset used for all protocols in Page::Socket::Client class
*/
Glib::RefPtr<Gio::SocketClient> Page::Socket::Client::create( Glib::RefPtr<Gio::SocketClient> Page::Socket::Client::create(
const int & TIMEOUT const int & TIMEOUT
) { ) {
@ -641,9 +647,14 @@ Glib::RefPtr<Gio::SocketClient> Page::Socket::Client::create(
return CLIENT; return CLIENT;
} }
/*
* Create and return socket client for Gemini protocol
*
* https://geminiprotocol.net/docs/protocol-specification.gmi
*/
Glib::RefPtr<Gio::SocketClient> Page::Socket::Client::Gemini::create() Glib::RefPtr<Gio::SocketClient> Page::Socket::Client::Gemini::create()
{ {
const auto GEMINI_CLIENT = Page::Socket::Client::create(); const auto GEMINI_CLIENT = create();
GEMINI_CLIENT->set_tls( GEMINI_CLIENT->set_tls(
true true
@ -660,16 +671,24 @@ Glib::RefPtr<Gio::SocketClient> Page::Socket::Client::Gemini::create()
return GEMINI_CLIENT; return GEMINI_CLIENT;
} }
/*
* Check socket connection active according to page class implementation
*/
bool Page::Socket::Connection::is_active( bool Page::Socket::Connection::is_active(
const Glib::RefPtr<Gio::SocketConnection> & CONNECTION const Glib::RefPtr<Gio::SocketConnection> & CONNECTION
) { ) {
return CONNECTION != nullptr && CONNECTION->is_connected(); 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( bool Page::Socket::Connection::close(
Glib::RefPtr<Gio::SocketConnection> & connection Glib::RefPtr<Gio::SocketConnection> & connection
) { ) {
if (Socket::Connection::is_active(connection)) if (is_active(connection))
{ {
if (connection->close()) if (connection->close())
{ {