diff options
author | Max Kellermann <max@duempel.org> | 2011-09-19 20:40:33 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-09-20 08:47:42 +0200 |
commit | f43873dc5fc845d4a195ea8b2328fcc9ae3565b1 (patch) | |
tree | 5f8810a33fb8591a7942d8bb22a6ed9cfc598d90 /src | |
parent | 921553d7bb38345ba99c069fa1ee7816d5130c9b (diff) | |
download | mpd-f43873dc5fc845d4a195ea8b2328fcc9ae3565b1.tar.gz mpd-f43873dc5fc845d4a195ea8b2328fcc9ae3565b1.tar.xz mpd-f43873dc5fc845d4a195ea8b2328fcc9ae3565b1.zip |
tcp_socket, udp_server: use g_io_channel_new_socket()
Diffstat (limited to 'src')
-rw-r--r-- | src/tcp_socket.c | 7 | ||||
-rw-r--r-- | src/udp_server.c | 7 |
2 files changed, 4 insertions, 10 deletions
diff --git a/src/tcp_socket.c b/src/tcp_socket.c index f65b9c07c..b64796fe6 100644 --- a/src/tcp_socket.c +++ b/src/tcp_socket.c @@ -20,6 +20,7 @@ #include "tcp_socket.h" #include "fifo_buffer.h" #include "io_thread.h" +#include "glib_socket.h" #include <assert.h> #include <string.h> @@ -317,11 +318,7 @@ tcp_socket_new(int fd, g_mutex_lock(s->mutex); -#ifndef G_OS_WIN32 - s->channel = g_io_channel_unix_new(fd); -#else - s->channel = g_io_channel_win32_new_socket(fd); -#endif + s->channel = g_io_channel_new_socket(fd); /* GLib is responsible for closing the file descriptor */ g_io_channel_set_close_on_unref(s->channel, true); /* NULL encoding means the stream is binary safe */ diff --git a/src/udp_server.c b/src/udp_server.c index 152eb37d1..e1c0b1545 100644 --- a/src/udp_server.c +++ b/src/udp_server.c @@ -19,6 +19,7 @@ #include "udp_server.h" #include "io_thread.h" +#include "glib_socket.h" #include "gcc.h" #include <glib.h> @@ -112,11 +113,7 @@ udp_server_new(unsigned port, udp->handler_ctx = ctx; udp->fd = fd; -#ifndef G_OS_WIN32 - udp->channel = g_io_channel_unix_new(fd); -#else - udp->channel = g_io_channel_win32_new_socket(fd); -#endif + udp->channel = g_io_channel_new_socket(fd); /* NULL encoding means the stream is binary safe */ g_io_channel_set_encoding(udp->channel, NULL, NULL); /* no buffering */ |