Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ReadMailReallyFast
code
Commits
d03c8264
Commit
d03c8264
authored
3 years ago
by
Leon Dietrich
Committed by
Benny Baumann
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add: Async server socket documentation
parent
d815690a
No related branches found
No related tags found
1 merge request
!1
First unit tests
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/net/async_server.hpp
+39
-2
39 additions, 2 deletions
src/net/async_server.hpp
with
39 additions
and
2 deletions
src/net/async_server.hpp
+
39
−
2
View file @
d03c8264
...
@@ -9,6 +9,17 @@
...
@@ -9,6 +9,17 @@
namespace
rmrf
::
net
{
namespace
rmrf
::
net
{
/**
* This class handles raw server sockets and wrapps them with automatic
* resource management functions. This class is an internal helper class
* utilized by classes like the TCP Server and thus shouldn't be used directly.
* @class async_server_socket
* @author leondietrich
* @date 14/07/21
* @file async_server.hpp
* @brief An asynchronous server socket handler.
* @see rmrf::net::tcp_server_socket
*/
class
async_server_socket
:
public
std
::
enable_shared_from_this
<
async_server_socket
>
{
class
async_server_socket
:
public
std
::
enable_shared_from_this
<
async_server_socket
>
{
public:
public:
typedef
std
::
shared_ptr
<
async_server_socket
>
self_ptr_type
;
typedef
std
::
shared_ptr
<
async_server_socket
>
self_ptr_type
;
...
@@ -25,11 +36,37 @@ private:
...
@@ -25,11 +36,37 @@ private:
::
ev
::
io
io
;
::
ev
::
io
io
;
public:
public:
/**
* This constructor accepts your given file descriptor to the operating systems socket.
* @param fd A handle to the socket in form of an auto_fd
*/
async_server_socket
(
auto_fd
&&
fd
);
async_server_socket
(
auto_fd
&&
fd
);
/**
* This deconstructor automatically unregisteres the socket from libev which in turn automatically removes it from
* the watch list of active sockets. However this does not close the socket in the kernels perspective so you must
* use always auto_fd.
* @brief Automatically unregister the socket from libev
*/
~
async_server_socket
();
~
async_server_socket
();
accept_handler_type
get_accept_handler
()
const
;
/**
void
set_accept_handler
(
const
accept_handler_type
&
value
);
* This method will return the currently used connection acceptance handler.
* Be aware that it will return an invalid state unless you used set_accept_handler
* prior to calling this method.
* @brief get the current registered accept handler
* @return The current accept handler
*/
accept_handler_type
get_accept_handler
()
const
;
/**
* Use this method in order to set a new incomming socket acceptance handler.
* It's best to call this method right after the constructor call of this class.
* @brief Set a new acceptance handler
* @param value The new handler to set
*/
void
set_accept_handler
(
const
accept_handler_type
&
value
);
private:
private:
void
cb_ev
(
::
ev
::
io
&
w
,
int
events
);
void
cb_ev
(
::
ev
::
io
&
w
,
int
events
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment