io: fix incoming client socket initialization

The channel socket was initialized manually, but forgot to set
QIO_CHANNEL_FEATURE_SHUTDOWN. Thus, the colo_process_incoming_thread
would hang at recvmsg. This patch just call qio_channel_socket_new to
get channel, Which set QIO_CHANNEL_FEATURE_SHUTDOWN already.

Signed-off-by: Wang Guang<wang.guang55@zte.com.cn>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Wang guang 2017-04-03 12:05:21 +01:00 committed by Daniel P. Berrange
parent 87cc4c6102
commit 0e5d6327f3
2 changed files with 9 additions and 7 deletions

View File

@ -331,16 +331,10 @@ qio_channel_socket_accept(QIOChannelSocket *ioc,
{ {
QIOChannelSocket *cioc; QIOChannelSocket *cioc;
cioc = QIO_CHANNEL_SOCKET(object_new(TYPE_QIO_CHANNEL_SOCKET)); cioc = qio_channel_socket_new();
cioc->fd = -1;
cioc->remoteAddrLen = sizeof(ioc->remoteAddr); cioc->remoteAddrLen = sizeof(ioc->remoteAddr);
cioc->localAddrLen = sizeof(ioc->localAddr); cioc->localAddrLen = sizeof(ioc->localAddr);
#ifdef WIN32
QIO_CHANNEL(cioc)->event = CreateEvent(NULL, FALSE, FALSE, NULL);
#endif
retry: retry:
trace_qio_channel_socket_accept(ioc); trace_qio_channel_socket_accept(ioc);
cioc->fd = qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr, cioc->fd = qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr,

View File

@ -234,6 +234,8 @@ static void test_io_channel(bool async,
qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS)); qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS));
g_assert(!passFD || g_assert(!passFD ||
qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS)); qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS));
g_assert(qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_SHUTDOWN));
g_assert(qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_SHUTDOWN));
test = qio_channel_test_new(); test = qio_channel_test_new();
qio_channel_test_run_threads(test, true, src, dst); qio_channel_test_run_threads(test, true, src, dst);
@ -248,6 +250,8 @@ static void test_io_channel(bool async,
qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS)); qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS));
g_assert(!passFD || g_assert(!passFD ||
qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS)); qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS));
g_assert(qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_SHUTDOWN));
g_assert(qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_SHUTDOWN));
test = qio_channel_test_new(); test = qio_channel_test_new();
qio_channel_test_run_threads(test, false, src, dst); qio_channel_test_run_threads(test, false, src, dst);
@ -262,6 +266,8 @@ static void test_io_channel(bool async,
qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS)); qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS));
g_assert(!passFD || g_assert(!passFD ||
qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS)); qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS));
g_assert(qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_SHUTDOWN));
g_assert(qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_SHUTDOWN));
test = qio_channel_test_new(); test = qio_channel_test_new();
qio_channel_test_run_threads(test, true, src, dst); qio_channel_test_run_threads(test, true, src, dst);
@ -276,6 +282,8 @@ static void test_io_channel(bool async,
qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS)); qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS));
g_assert(!passFD || g_assert(!passFD ||
qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS)); qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS));
g_assert(qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_SHUTDOWN));
g_assert(qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_SHUTDOWN));
test = qio_channel_test_new(); test = qio_channel_test_new();
qio_channel_test_run_threads(test, false, src, dst); qio_channel_test_run_threads(test, false, src, dst);