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
bb5dfd40
Verified
Commit
bb5dfd40
authored
4 years ago
by
Benny Baumann
Browse files
Options
Downloads
Patches
Plain Diff
fix: Callback fixes
parent
efccdb13
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
+23
-4
23 additions, 4 deletions
src/net/async_server.hpp
with
23 additions
and
4 deletions
src/net/async_server.hpp
+
23
−
4
View file @
bb5dfd40
...
@@ -26,10 +26,10 @@ private:
...
@@ -26,10 +26,10 @@ private:
public:
public:
async_server_socket
(
auto_fd
&&
fd
)
:
socket
(
std
::
forward
(
fd
))
{
async_server_socket
(
auto_fd
&&
fd
)
:
socket
(
std
::
forward
(
fd
))
{
// This constructor got a constructed socket as an argument
// This constructor got a constructed socket as an argument
// and forwards it to libev
// and forwards it to libev
io
.
set
<
async_server_socket
,
&
async_server_socket
::
get_accept_handler
()
>
(
this
);
io
.
set
<
async_server_socket
,
&
async_server_socket
::
cb_ev
>
(
this
);
io
.
start
(
this
->
socket
,
ev
::
READ
);
io
.
start
(
this
->
socket
.
get
()
,
ev
::
READ
);
}
}
~
async_server_socket
()
{
~
async_server_socket
()
{
// Remove this socket from libev ...
// Remove this socket from libev ...
...
@@ -43,6 +43,25 @@ public:
...
@@ -43,6 +43,25 @@ public:
void
set_accept_handler
(
const
accept_handler_type
&
value
)
{
void
set_accept_handler
(
const
accept_handler_type
&
value
)
{
on_accept
=
value
;
on_accept
=
value
;
}
}
private
:
void
cb_ev
(
::
ev
::
io
&
w
,
int
events
)
{
(
void
)
w
;
if
(
events
&
::
ev
::
READ
)
{
auto
ah
=
this
->
get_accept_handler
();
// Handle accepting clients
}
if
(
events
&
::
ev
::
WRITE
)
{
// Handle sending data (none for servers)
}
if
(
events
&
::
ev
::
ERROR
)
{
// Handle error conditions
}
}
};
};
}
}
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