tcp_socket, udp_server: use g_io_channel_new_socket()

This commit is contained in:
Max Kellermann 2011-09-19 20:40:33 +02:00
parent 921553d7bb
commit f43873dc5f
2 changed files with 4 additions and 10 deletions

View File

@ -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 */

View File

@ -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 */