Commit f43873dc authored by Max Kellermann's avatar Max Kellermann

tcp_socket, udp_server: use g_io_channel_new_socket()

parent 921553d7
......@@ -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 */
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment