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
f48e6ff6
Commit
f48e6ff6
authored
4 years ago
by
Leon Dietrich
Browse files
Options
Downloads
Patches
Plain Diff
chg: Working on libev integration withion async_socket
parent
877d158d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/net/async_server.hpp
+9
-1
9 additions, 1 deletion
src/net/async_server.hpp
with
9 additions
and
1 deletion
src/net/async_server.hpp
+
9
−
1
View file @
f48e6ff6
#pragma once
#pragma once
#include
<ev++.h>
#include
<functional>
#include
<functional>
#include
<memory>
#include
<memory>
...
@@ -20,12 +22,18 @@ private:
...
@@ -20,12 +22,18 @@ private:
accept_handler_type
on_accept
;
accept_handler_type
on_accept
;
error_handler_type
on_error
;
error_handler_type
on_error
;
ev
::
io
io
;
public:
public:
async_server_socket
(
auto_fd
&&
fd
)
:
socket
(
std
::
forward
(
fd
))
{
async_server_socket
(
auto_fd
&&
fd
)
:
socket
(
std
::
forward
(
fd
))
{
// Add this socket to libev ...
// This constructor got a constructed socket as an argument
// and forwards it to libev
io
.
set
<
async_server_socket
,
&
async_server_socket
::
get_accept_handler
()
>
(
this
);
io
.
start
(
this
->
socket
,
ev
::
READ
);
}
}
~
async_server_socket
()
{
~
async_server_socket
()
{
// Remove this socket from libev ...
// Remove this socket from libev ...
io
.
stop
();
}
}
public
:
public
:
...
...
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