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
5fb21fbd
Commit
5fb21fbd
authored
Oct 30, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/ServerSocket: add `noexcept`
parent
f5857c46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
ServerSocket.cxx
src/event/ServerSocket.cxx
+11
-11
ServerSocket.hxx
src/event/ServerSocket.hxx
+8
-8
No files found.
src/event/ServerSocket.cxx
View file @
5fb21fbd
...
@@ -67,7 +67,7 @@ public:
...
@@ -67,7 +67,7 @@ public:
template
<
typename
A
>
template
<
typename
A
>
OneServerSocket
(
EventLoop
&
_loop
,
ServerSocket
&
_parent
,
OneServerSocket
(
EventLoop
&
_loop
,
ServerSocket
&
_parent
,
unsigned
_serial
,
unsigned
_serial
,
A
&&
_address
)
A
&&
_address
)
noexcept
:
SocketMonitor
(
_loop
),
:
SocketMonitor
(
_loop
),
parent
(
_parent
),
serial
(
_serial
),
parent
(
_parent
),
serial
(
_serial
),
#ifdef HAVE_UN
#ifdef HAVE_UN
...
@@ -80,17 +80,17 @@ public:
...
@@ -80,17 +80,17 @@ public:
OneServerSocket
(
const
OneServerSocket
&
other
)
=
delete
;
OneServerSocket
(
const
OneServerSocket
&
other
)
=
delete
;
OneServerSocket
&
operator
=
(
const
OneServerSocket
&
other
)
=
delete
;
OneServerSocket
&
operator
=
(
const
OneServerSocket
&
other
)
=
delete
;
~
OneServerSocket
()
{
~
OneServerSocket
()
noexcept
{
if
(
IsDefined
())
if
(
IsDefined
())
Close
();
Close
();
}
}
unsigned
GetSerial
()
const
{
unsigned
GetSerial
()
const
noexcept
{
return
serial
;
return
serial
;
}
}
#ifdef HAVE_UN
#ifdef HAVE_UN
void
SetPath
(
AllocatedPath
&&
_path
)
{
void
SetPath
(
AllocatedPath
&&
_path
)
noexcept
{
assert
(
path
.
IsNull
());
assert
(
path
.
IsNull
());
path
=
std
::
move
(
_path
);
path
=
std
::
move
(
_path
);
...
@@ -197,12 +197,12 @@ OneServerSocket::Open()
...
@@ -197,12 +197,12 @@ OneServerSocket::Open()
SetFD
(
_fd
.
Release
());
SetFD
(
_fd
.
Release
());
}
}
ServerSocket
::
ServerSocket
(
EventLoop
&
_loop
)
ServerSocket
::
ServerSocket
(
EventLoop
&
_loop
)
noexcept
:
loop
(
_loop
),
next_serial
(
1
)
{}
:
loop
(
_loop
),
next_serial
(
1
)
{}
/* this is just here to allow the OneServerSocket forward
/* this is just here to allow the OneServerSocket forward
declaration */
declaration */
ServerSocket
::~
ServerSocket
()
{}
ServerSocket
::~
ServerSocket
()
noexcept
=
default
;
void
void
ServerSocket
::
Open
()
ServerSocket
::
Open
()
...
@@ -265,7 +265,7 @@ ServerSocket::Open()
...
@@ -265,7 +265,7 @@ ServerSocket::Open()
}
}
void
void
ServerSocket
::
Close
()
ServerSocket
::
Close
()
noexcept
{
{
for
(
auto
&
i
:
sockets
)
for
(
auto
&
i
:
sockets
)
if
(
i
.
IsDefined
())
if
(
i
.
IsDefined
())
...
@@ -273,7 +273,7 @@ ServerSocket::Close()
...
@@ -273,7 +273,7 @@ ServerSocket::Close()
}
}
OneServerSocket
&
OneServerSocket
&
ServerSocket
::
AddAddress
(
SocketAddress
address
)
ServerSocket
::
AddAddress
(
SocketAddress
address
)
noexcept
{
{
sockets
.
emplace_back
(
loop
,
*
this
,
next_serial
,
sockets
.
emplace_back
(
loop
,
*
this
,
next_serial
,
address
);
address
);
...
@@ -282,7 +282,7 @@ ServerSocket::AddAddress(SocketAddress address)
...
@@ -282,7 +282,7 @@ ServerSocket::AddAddress(SocketAddress address)
}
}
OneServerSocket
&
OneServerSocket
&
ServerSocket
::
AddAddress
(
AllocatedSocketAddress
&&
address
)
ServerSocket
::
AddAddress
(
AllocatedSocketAddress
&&
address
)
noexcept
{
{
sockets
.
emplace_back
(
loop
,
*
this
,
next_serial
,
sockets
.
emplace_back
(
loop
,
*
this
,
next_serial
,
std
::
move
(
address
));
std
::
move
(
address
));
...
@@ -308,7 +308,7 @@ ServerSocket::AddFD(int _fd)
...
@@ -308,7 +308,7 @@ ServerSocket::AddFD(int _fd)
#ifdef HAVE_TCP
#ifdef HAVE_TCP
inline
void
inline
void
ServerSocket
::
AddPortIPv4
(
unsigned
port
)
ServerSocket
::
AddPortIPv4
(
unsigned
port
)
noexcept
{
{
AddAddress
(
IPv4Address
(
port
));
AddAddress
(
IPv4Address
(
port
));
}
}
...
@@ -316,7 +316,7 @@ ServerSocket::AddPortIPv4(unsigned port)
...
@@ -316,7 +316,7 @@ ServerSocket::AddPortIPv4(unsigned port)
#ifdef HAVE_IPV6
#ifdef HAVE_IPV6
inline
void
inline
void
ServerSocket
::
AddPortIPv6
(
unsigned
port
)
ServerSocket
::
AddPortIPv6
(
unsigned
port
)
noexcept
{
{
struct
sockaddr_in6
sin
;
struct
sockaddr_in6
sin
;
memset
(
&
sin
,
0
,
sizeof
(
sin
));
memset
(
&
sin
,
0
,
sizeof
(
sin
));
...
...
src/event/ServerSocket.hxx
View file @
5fb21fbd
...
@@ -42,30 +42,30 @@ class ServerSocket {
...
@@ -42,30 +42,30 @@ class ServerSocket {
unsigned
next_serial
;
unsigned
next_serial
;
public
:
public
:
ServerSocket
(
EventLoop
&
_loop
);
ServerSocket
(
EventLoop
&
_loop
)
noexcept
;
~
ServerSocket
();
~
ServerSocket
()
noexcept
;
EventLoop
&
GetEventLoop
()
{
EventLoop
&
GetEventLoop
()
const
noexcept
{
return
loop
;
return
loop
;
}
}
private
:
private
:
OneServerSocket
&
AddAddress
(
SocketAddress
address
);
OneServerSocket
&
AddAddress
(
SocketAddress
address
)
noexcept
;
OneServerSocket
&
AddAddress
(
AllocatedSocketAddress
&&
address
);
OneServerSocket
&
AddAddress
(
AllocatedSocketAddress
&&
address
)
noexcept
;
/**
/**
* Add a listener on a port on all IPv4 interfaces.
* Add a listener on a port on all IPv4 interfaces.
*
*
* @param port the TCP port
* @param port the TCP port
*/
*/
void
AddPortIPv4
(
unsigned
port
);
void
AddPortIPv4
(
unsigned
port
)
noexcept
;
/**
/**
* Add a listener on a port on all IPv6 interfaces.
* Add a listener on a port on all IPv6 interfaces.
*
*
* @param port the TCP port
* @param port the TCP port
*/
*/
void
AddPortIPv6
(
unsigned
port
);
void
AddPortIPv6
(
unsigned
port
)
noexcept
;
public
:
public
:
/**
/**
...
@@ -118,7 +118,7 @@ public:
...
@@ -118,7 +118,7 @@ public:
*/
*/
void
Open
();
void
Open
();
void
Close
();
void
Close
()
noexcept
;
protected
:
protected
:
virtual
void
OnAccept
(
UniqueSocketDescriptor
fd
,
virtual
void
OnAccept
(
UniqueSocketDescriptor
fd
,
...
...
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