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
ab30695b
Commit
ab30695b
authored
Dec 28, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/httpd: add `noexcept`
parent
53a4de35
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
38 deletions
+40
-38
HttpdClient.cxx
src/output/plugins/httpd/HttpdClient.cxx
+14
-13
HttpdClient.hxx
src/output/plugins/httpd/HttpdClient.hxx
+14
-13
HttpdInternal.hxx
src/output/plugins/httpd/HttpdInternal.hxx
+6
-6
HttpdOutputPlugin.cxx
src/output/plugins/httpd/HttpdOutputPlugin.cxx
+6
-6
No files found.
src/output/plugins/httpd/HttpdClient.cxx
View file @
ab30695b
...
...
@@ -31,27 +31,27 @@
#include <string.h>
#include <stdio.h>
HttpdClient
::~
HttpdClient
()
HttpdClient
::~
HttpdClient
()
noexcept
{
if
(
IsDefined
())
BufferedSocket
::
Close
();
}
void
HttpdClient
::
Close
()
HttpdClient
::
Close
()
noexcept
{
httpd
.
RemoveClient
(
*
this
);
}
void
HttpdClient
::
LockClose
()
HttpdClient
::
LockClose
()
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
httpd
.
mutex
);
Close
();
}
void
HttpdClient
::
BeginResponse
()
HttpdClient
::
BeginResponse
()
noexcept
{
assert
(
state
!=
State
::
RESPONSE
);
...
...
@@ -66,7 +66,7 @@ HttpdClient::BeginResponse()
* Handle a line of the HTTP request.
*/
bool
HttpdClient
::
HandleLine
(
const
char
*
line
)
HttpdClient
::
HandleLine
(
const
char
*
line
)
noexcept
{
assert
(
state
!=
State
::
RESPONSE
);
...
...
@@ -121,7 +121,7 @@ HttpdClient::HandleLine(const char *line)
* Sends the status line and response headers to the client.
*/
bool
HttpdClient
::
SendResponse
()
HttpdClient
::
SendResponse
()
noexcept
{
char
buffer
[
1024
];
AllocatedString
<>
allocated
=
nullptr
;
...
...
@@ -171,7 +171,7 @@ HttpdClient::HttpdClient(HttpdOutput &_httpd, UniqueSocketDescriptor _fd,
}
void
HttpdClient
::
ClearQueue
()
HttpdClient
::
ClearQueue
()
noexcept
{
assert
(
state
==
State
::
RESPONSE
);
...
...
@@ -189,7 +189,7 @@ HttpdClient::ClearQueue()
}
void
HttpdClient
::
CancelQueue
()
HttpdClient
::
CancelQueue
()
noexcept
{
if
(
state
!=
State
::
RESPONSE
)
return
;
...
...
@@ -201,7 +201,7 @@ HttpdClient::CancelQueue()
}
ssize_t
HttpdClient
::
TryWritePage
(
const
Page
&
page
,
size_t
position
)
HttpdClient
::
TryWritePage
(
const
Page
&
page
,
size_t
position
)
noexcept
{
assert
(
position
<
page
.
GetSize
());
...
...
@@ -210,7 +210,8 @@ HttpdClient::TryWritePage(const Page &page, size_t position)
}
ssize_t
HttpdClient
::
TryWritePageN
(
const
Page
&
page
,
size_t
position
,
ssize_t
n
)
HttpdClient
::
TryWritePageN
(
const
Page
&
page
,
size_t
position
,
ssize_t
n
)
noexcept
{
return
n
>=
0
?
GetSocket
().
Write
(
page
.
GetData
()
+
position
,
n
)
...
...
@@ -228,7 +229,7 @@ HttpdClient::GetBytesTillMetaData() const noexcept
}
inline
bool
HttpdClient
::
TryWrite
()
HttpdClient
::
TryWrite
()
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
httpd
.
mutex
);
...
...
@@ -342,7 +343,7 @@ HttpdClient::TryWrite()
}
void
HttpdClient
::
PushPage
(
PagePtr
page
)
HttpdClient
::
PushPage
(
PagePtr
page
)
noexcept
{
if
(
state
!=
State
::
RESPONSE
)
/* the client is still writing the HTTP request */
...
...
@@ -361,7 +362,7 @@ HttpdClient::PushPage(PagePtr page)
}
void
HttpdClient
::
PushMetaData
(
PagePtr
page
)
HttpdClient
::
PushMetaData
(
PagePtr
page
)
noexcept
{
assert
(
page
!=
nullptr
);
...
...
src/output/plugins/httpd/HttpdClient.hxx
View file @
ab30695b
...
...
@@ -138,55 +138,56 @@ public:
* Note: this does not remove the client from the
* #HttpdOutput object.
*/
~
HttpdClient
();
~
HttpdClient
()
noexcept
;
/**
* Frees the client and removes it from the server's client list.
*/
void
Close
();
void
Close
()
noexcept
;
void
LockClose
();
void
LockClose
()
noexcept
;
/**
* Clears the page queue.
*/
void
CancelQueue
();
void
CancelQueue
()
noexcept
;
/**
* Handle a line of the HTTP request.
*/
bool
HandleLine
(
const
char
*
line
);
bool
HandleLine
(
const
char
*
line
)
noexcept
;
/**
* Switch the client to #State::RESPONSE.
*/
void
BeginResponse
();
void
BeginResponse
()
noexcept
;
/**
* Sends the status line and response headers to the client.
*/
bool
SendResponse
();
bool
SendResponse
()
noexcept
;
gcc_pure
ssize_t
GetBytesTillMetaData
()
const
noexcept
;
ssize_t
TryWritePage
(
const
Page
&
page
,
size_t
position
);
ssize_t
TryWritePageN
(
const
Page
&
page
,
size_t
position
,
ssize_t
n
);
ssize_t
TryWritePage
(
const
Page
&
page
,
size_t
position
)
noexcept
;
ssize_t
TryWritePageN
(
const
Page
&
page
,
size_t
position
,
ssize_t
n
)
noexcept
;
bool
TryWrite
();
bool
TryWrite
()
noexcept
;
/**
* Appends a page to the client's queue.
*/
void
PushPage
(
PagePtr
page
);
void
PushPage
(
PagePtr
page
)
noexcept
;
/**
* Sends the passed metadata.
*/
void
PushMetaData
(
PagePtr
page
);
void
PushMetaData
(
PagePtr
page
)
noexcept
;
private
:
void
ClearQueue
();
void
ClearQueue
()
noexcept
;
protected
:
/* virtual methods from class SocketMonitor */
...
...
src/output/plugins/httpd/HttpdInternal.hxx
View file @
ab30695b
...
...
@@ -162,7 +162,7 @@ public:
using
ServerSocket
::
GetEventLoop
;
void
Bind
();
void
Unbind
();
void
Unbind
()
noexcept
;
void
Enable
()
override
{
Bind
();
...
...
@@ -208,18 +208,18 @@ public:
return
HasClients
();
}
void
AddClient
(
UniqueSocketDescriptor
fd
);
void
AddClient
(
UniqueSocketDescriptor
fd
)
noexcept
;
/**
* Removes a client from the httpd_output.clients linked list.
*/
void
RemoveClient
(
HttpdClient
&
client
);
void
RemoveClient
(
HttpdClient
&
client
)
noexcept
;
/**
* Sends the encoder header to the client. This is called
* right after the response headers have been sent.
*/
void
SendHeader
(
HttpdClient
&
client
)
const
;
void
SendHeader
(
HttpdClient
&
client
)
const
noexcept
;
gcc_pure
std
::
chrono
::
steady_clock
::
duration
Delay
()
const
noexcept
override
;
...
...
@@ -235,7 +235,7 @@ public:
*
* Mutext must not be locked.
*/
void
BroadcastPage
(
PagePtr
page
);
void
BroadcastPage
(
PagePtr
page
)
noexcept
;
/**
* Broadcasts data from the encoder to all clients.
...
...
@@ -251,7 +251,7 @@ public:
size_t
Play
(
const
void
*
chunk
,
size_t
size
)
override
;
void
CancelAllClients
();
void
CancelAllClients
()
noexcept
;
void
Cancel
()
noexcept
override
;
bool
Pause
()
override
;
...
...
src/output/plugins/httpd/HttpdOutputPlugin.cxx
View file @
ab30695b
...
...
@@ -77,7 +77,7 @@ HttpdOutput::Bind()
}
inline
void
HttpdOutput
::
Unbind
()
HttpdOutput
::
Unbind
()
noexcept
{
assert
(
!
open
);
...
...
@@ -91,7 +91,7 @@ HttpdOutput::Unbind()
* HttpdOutput.clients linked list.
*/
inline
void
HttpdOutput
::
AddClient
(
UniqueSocketDescriptor
fd
)
HttpdOutput
::
AddClient
(
UniqueSocketDescriptor
fd
)
noexcept
{
auto
*
client
=
new
HttpdClient
(
*
this
,
std
::
move
(
fd
),
GetEventLoop
(),
!
encoder
->
ImplementsTag
());
...
...
@@ -223,7 +223,7 @@ HttpdOutput::Close() noexcept
}
void
HttpdOutput
::
RemoveClient
(
HttpdClient
&
client
)
HttpdOutput
::
RemoveClient
(
HttpdClient
&
client
)
noexcept
{
assert
(
!
clients
.
empty
());
...
...
@@ -232,7 +232,7 @@ HttpdOutput::RemoveClient(HttpdClient &client)
}
void
HttpdOutput
::
SendHeader
(
HttpdClient
&
client
)
const
HttpdOutput
::
SendHeader
(
HttpdClient
&
client
)
const
noexcept
{
if
(
header
!=
nullptr
)
client
.
PushPage
(
header
);
...
...
@@ -260,7 +260,7 @@ HttpdOutput::Delay() const noexcept
}
void
HttpdOutput
::
BroadcastPage
(
PagePtr
page
)
HttpdOutput
::
BroadcastPage
(
PagePtr
page
)
noexcept
{
assert
(
page
!=
nullptr
);
...
...
@@ -386,7 +386,7 @@ HttpdOutput::SendTag(const Tag &tag)
}
inline
void
HttpdOutput
::
CancelAllClients
()
HttpdOutput
::
CancelAllClients
()
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
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