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
daffefdb
Commit
daffefdb
authored
Oct 30, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/ServerSocket: pass UniqueSocketDescriptor to AddFD()
parent
5fb21fbd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
+9
-10
Listen.cxx
src/Listen.cxx
+2
-1
ServerSocket.cxx
src/event/ServerSocket.cxx
+6
-8
ServerSocket.hxx
src/event/ServerSocket.hxx
+1
-1
No files found.
src/Listen.cxx
View file @
daffefdb
...
...
@@ -24,6 +24,7 @@
#include "config/Data.hxx"
#include "config/Option.hxx"
#include "config/Net.hxx"
#include "net/UniqueSocketDescriptor.hxx"
#include "system/Error.hxx"
#include "util/RuntimeError.hxx"
#include "fs/AllocatedPath.hxx"
...
...
@@ -66,7 +67,7 @@ listen_systemd_activation(ClientListener &listener)
for
(
int
i
=
SD_LISTEN_FDS_START
,
end
=
SD_LISTEN_FDS_START
+
n
;
i
!=
end
;
++
i
)
listener
.
AddFD
(
i
);
listener
.
AddFD
(
UniqueSocketDescriptor
(
i
)
);
return
true
;
}
...
...
src/event/ServerSocket.cxx
View file @
daffefdb
...
...
@@ -107,8 +107,8 @@ public:
return
::
ToString
(
address
);
}
void
SetFD
(
SocketDescriptor
_fd
)
noexcept
{
SocketMonitor
::
Open
(
_fd
);
void
SetFD
(
Unique
SocketDescriptor
_fd
)
noexcept
{
SocketMonitor
::
Open
(
_fd
.
Release
()
);
SocketMonitor
::
ScheduleRead
();
}
...
...
@@ -194,7 +194,7 @@ OneServerSocket::Open()
/* register in the EventLoop */
SetFD
(
_fd
.
Release
(
));
SetFD
(
std
::
move
(
_fd
));
}
ServerSocket
::
ServerSocket
(
EventLoop
&
_loop
)
noexcept
...
...
@@ -291,18 +291,16 @@ ServerSocket::AddAddress(AllocatedSocketAddress &&address) noexcept
}
void
ServerSocket
::
AddFD
(
int
_
fd
)
ServerSocket
::
AddFD
(
UniqueSocketDescriptor
fd
)
{
assert
(
_fd
>=
0
);
SocketDescriptor
fd
(
_fd
);
assert
(
fd
.
IsDefined
());
StaticSocketAddress
address
=
fd
.
GetLocalAddress
();
if
(
!
address
.
IsDefined
())
throw
MakeSocketError
(
"Failed to get socket address"
);
OneServerSocket
&
s
=
AddAddress
(
address
);
s
.
SetFD
(
fd
);
s
.
SetFD
(
std
::
move
(
fd
)
);
}
#ifdef HAVE_TCP
...
...
src/event/ServerSocket.hxx
View file @
daffefdb
...
...
@@ -107,7 +107,7 @@ public:
*
* Throws #std::runtime_error on error.
*/
void
AddFD
(
int
fd
);
void
AddFD
(
UniqueSocketDescriptor
fd
);
bool
IsEmpty
()
const
noexcept
{
return
sockets
.
empty
();
...
...
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