diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2015-02-27 16:20:57 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2015-12-18 15:02:11 +0000 |
commit | 04d2529da27db512dcbd5e99d0e26d333f16efcc (patch) | |
tree | 18af3a24cbaa0e697dc068673ce65cc30bd95f2b /ui/vnc-auth-vencrypt.c | |
parent | 18f49881cf8359e89396aac12f5d3cf3f8a632ba (diff) |
ui: convert VNC server to use QIOChannelSocket
The minimal first step conversion to use QIOChannelSocket
classes instead of directly using POSIX sockets API. This
will later be extended to also cover the TLS, SASL and
websockets code.
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'ui/vnc-auth-vencrypt.c')
-rw-r--r-- | ui/vnc-auth-vencrypt.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c index 44ac2fae63..95a6823483 100644 --- a/ui/vnc-auth-vencrypt.c +++ b/ui/vnc-auth-vencrypt.c @@ -63,7 +63,9 @@ static void start_auth_vencrypt_subauth(VncState *vs) } } -static void vnc_tls_handshake_io(void *opaque); +static gboolean vnc_tls_handshake_io(QIOChannel *ioc, + GIOCondition condition, + void *opaque); static int vnc_start_vencrypt_handshake(VncState *vs) { @@ -80,19 +82,31 @@ static int vnc_start_vencrypt_handshake(VncState *vs) goto error; } VNC_DEBUG("Client verification passed, starting TLS I/O\n"); - qemu_set_fd_handler(vs->csock, vnc_client_read, vnc_client_write, vs); + if (vs->ioc_tag) { + g_source_remove(vs->ioc_tag); + } + vs->ioc_tag = qio_channel_add_watch( + vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL); start_auth_vencrypt_subauth(vs); break; case QCRYPTO_TLS_HANDSHAKE_RECVING: VNC_DEBUG("Handshake interrupted (blocking read)\n"); - qemu_set_fd_handler(vs->csock, vnc_tls_handshake_io, NULL, vs); + if (vs->ioc_tag) { + g_source_remove(vs->ioc_tag); + } + vs->ioc_tag = qio_channel_add_watch( + vs->ioc, G_IO_IN, vnc_tls_handshake_io, vs, NULL); break; case QCRYPTO_TLS_HANDSHAKE_SENDING: VNC_DEBUG("Handshake interrupted (blocking write)\n"); - qemu_set_fd_handler(vs->csock, NULL, vnc_tls_handshake_io, vs); + if (vs->ioc_tag) { + g_source_remove(vs->ioc_tag); + } + vs->ioc_tag = qio_channel_add_watch( + vs->ioc, G_IO_OUT, vnc_tls_handshake_io, vs, NULL); break; } @@ -105,12 +119,15 @@ static int vnc_start_vencrypt_handshake(VncState *vs) return -1; } -static void vnc_tls_handshake_io(void *opaque) +static gboolean vnc_tls_handshake_io(QIOChannel *ioc G_GNUC_UNUSED, + GIOCondition condition G_GNUC_UNUSED, + void *opaque) { VncState *vs = (VncState *)opaque; VNC_DEBUG("Handshake IO continue\n"); vnc_start_vencrypt_handshake(vs); + return TRUE; } |