aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-30 12:56:23 +0100
committerMax Kellermann <max@duempel.org>2013-01-30 13:40:56 +0100
commitad5eb2f8d6f32c69603e658e14d813d71ba5b220 (patch)
tree89ff752ba4d73677c45ffbcdb4f4d19d4c7123a6 /src/output
parent39d56d6b65dd8441afb39eb60553e25e768bbe7f (diff)
downloadmpd-ad5eb2f8d6f32c69603e658e14d813d71ba5b220.tar.gz
mpd-ad5eb2f8d6f32c69603e658e14d813d71ba5b220.tar.xz
mpd-ad5eb2f8d6f32c69603e658e14d813d71ba5b220.zip
ServerSocket: expose the class
Eliminate the C wrappers.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/HttpdInternal.hxx3
-rw-r--r--src/output/HttpdOutputPlugin.cxx15
2 files changed, 9 insertions, 9 deletions
diff --git a/src/output/HttpdInternal.hxx b/src/output/HttpdInternal.hxx
index 702f4ad3d..5c5abd0d5 100644
--- a/src/output/HttpdInternal.hxx
+++ b/src/output/HttpdInternal.hxx
@@ -36,6 +36,7 @@
#include <stdbool.h>
+class ServerSocket;
class HttpdClient;
struct HttpdOutput {
@@ -80,7 +81,7 @@ struct HttpdOutput {
/**
* The listener socket.
*/
- struct server_socket *server_socket;
+ ServerSocket *server_socket;
/**
* The header page, which is sent to every client on connect.
diff --git a/src/output/HttpdOutputPlugin.cxx b/src/output/HttpdOutputPlugin.cxx
index 871047a5f..f9a40a4e1 100644
--- a/src/output/HttpdOutputPlugin.cxx
+++ b/src/output/HttpdOutputPlugin.cxx
@@ -64,7 +64,7 @@ HttpdOutput::Bind(GError **error_r)
open = false;
const ScopeLock protect(mutex);
- return server_socket_open(server_socket, error_r);
+ return server_socket->Open(error_r);
}
inline void
@@ -73,7 +73,7 @@ HttpdOutput::Unbind()
assert(!open);
const ScopeLock protect(mutex);
- server_socket_close(server_socket);
+ server_socket->Close();
}
static struct audio_output *
@@ -112,16 +112,15 @@ httpd_output_init(const struct config_param *param,
/* set up bind_to_address */
- httpd->server_socket = server_socket_new(*main_loop,
- httpd_listen_in_event, httpd);
+ httpd->server_socket = new ServerSocket(*main_loop,
+ httpd_listen_in_event, httpd);
const char *bind_to_address =
config_get_block_string(param, "bind_to_address", NULL);
bool success = bind_to_address != NULL &&
strcmp(bind_to_address, "any") != 0
- ? server_socket_add_host(httpd->server_socket, bind_to_address,
- port, error)
- : server_socket_add_port(httpd->server_socket, port, error);
+ ? httpd->server_socket->AddHost(bind_to_address, port, error)
+ : httpd->server_socket->AddPort(port, error);
if (!success) {
ao_base_finish(&httpd->base);
g_free(httpd);
@@ -159,7 +158,7 @@ httpd_output_finish(struct audio_output *ao)
httpd->metadata->Unref();
encoder_finish(httpd->encoder);
- server_socket_free(httpd->server_socket);
+ delete httpd->server_socket;
ao_base_finish(&httpd->base);
delete httpd;
}