Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
614b3634
Commit
614b3634
authored
Aug 11, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net/SocketDescriptor: add AcceptNonBlock() overload without address
parent
b234f430
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
SocketDescriptor.cxx
src/net/SocketDescriptor.cxx
+14
-0
SocketDescriptor.hxx
src/net/SocketDescriptor.hxx
+1
-0
UniqueSocketDescriptor.hxx
src/net/UniqueSocketDescriptor.hxx
+7
-0
No files found.
src/net/SocketDescriptor.cxx
View file @
614b3634
...
...
@@ -69,6 +69,20 @@ SocketDescriptor::Accept()
}
SocketDescriptor
SocketDescriptor
::
AcceptNonBlock
()
const
{
#ifdef HAVE_ACCEPT4
int
connection_fd
=
::
accept4
(
Get
(),
nullptr
,
nullptr
,
SOCK_CLOEXEC
|
SOCK_NONBLOCK
);
#else
int
connection_fd
=
::
accept
(
Get
(),
nullptr
,
nullptr
);
if
(
connection_fd
>=
0
)
SocketDescriptor
(
connection_fd
).
SetNonBlocking
();
#endif
return
SocketDescriptor
(
connection_fd
);
}
SocketDescriptor
SocketDescriptor
::
AcceptNonBlock
(
StaticSocketAddress
&
address
)
const
{
address
.
SetMaxSize
();
...
...
src/net/SocketDescriptor.hxx
View file @
614b3634
...
...
@@ -173,6 +173,7 @@ public:
bool
Listen
(
int
backlog
);
SocketDescriptor
Accept
();
SocketDescriptor
AcceptNonBlock
()
const
;
SocketDescriptor
AcceptNonBlock
(
StaticSocketAddress
&
address
)
const
;
bool
Connect
(
SocketAddress
address
);
...
...
src/net/UniqueSocketDescriptor.hxx
View file @
614b3634
...
...
@@ -79,6 +79,13 @@ public:
/**
* @return an "undefined" instance on error
*/
UniqueSocketDescriptor
AcceptNonBlock
()
const
{
return
UniqueSocketDescriptor
(
SocketDescriptor
::
AcceptNonBlock
());
}
/**
* @return an "undefined" instance on error
*/
UniqueSocketDescriptor
AcceptNonBlock
(
StaticSocketAddress
&
address
)
const
{
return
UniqueSocketDescriptor
(
SocketDescriptor
::
AcceptNonBlock
(
address
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment