From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqJnw-00024p-LB for qemu-devel@nongnu.org; Fri, 08 Sep 2017 09:58:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqJnv-0005g9-FF for qemu-devel@nongnu.org; Fri, 08 Sep 2017 09:58:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dqJnv-0005em-6j for qemu-devel@nongnu.org; Fri, 08 Sep 2017 09:58:43 -0400 From: "Daniel P. Berrange" Date: Fri, 8 Sep 2017 14:58:30 +0100 Message-Id: <20170908135831.10556-3-berrange@redhat.com> In-Reply-To: <20170908135831.10556-1-berrange@redhat.com> References: <20170908135831.10556-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v3 2/3] io: include full error message in websocket handshake trace List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Brian Rak , "Daniel P. Berrange" When the websocket handshake fails it is useful to log the real error message via the trace points for debugging purposes. Fixes bug: #1715186 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Daniel P. Berrange --- io/channel-websock.c | 7 ++++--- io/trace-events | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/io/channel-websock.c b/io/channel-websock.c index cc93a23f8b..5d2df95596 100644 --- a/io/channel-websock.c +++ b/io/channel-websock.c @@ -508,7 +508,7 @@ static gboolean qio_channel_websock_handshake_send(QI= OChannel *ioc, &err); =20 if (ret < 0) { - trace_qio_channel_websock_handshake_fail(ioc); + trace_qio_channel_websock_handshake_fail(ioc, error_get_pretty(e= rr)); qio_task_set_error(task, err); qio_task_complete(task); return FALSE; @@ -517,7 +517,8 @@ static gboolean qio_channel_websock_handshake_send(QI= OChannel *ioc, buffer_advance(&wioc->encoutput, ret); if (wioc->encoutput.offset =3D=3D 0) { if (wioc->io_err) { - trace_qio_channel_websock_handshake_fail(ioc); + trace_qio_channel_websock_handshake_fail( + ioc, error_get_pretty(wioc->io_err)); qio_task_set_error(task, wioc->io_err); wioc->io_err =3D NULL; qio_task_complete(task); @@ -548,7 +549,7 @@ static gboolean qio_channel_websock_handshake_io(QIOC= hannel *ioc, * client connection, as most of the time we have an * HTTP 4xx err response to send instead */ - trace_qio_channel_websock_handshake_fail(ioc); + trace_qio_channel_websock_handshake_fail(ioc, error_get_pretty(e= rr)); qio_task_set_error(task, err); qio_task_complete(task); return FALSE; diff --git a/io/trace-events b/io/trace-events index 3d233698d0..6459f71f5b 100644 --- a/io/trace-events +++ b/io/trace-events @@ -46,7 +46,7 @@ qio_channel_websock_new_server(void *ioc, void *master)= "Websock new client ioc=3D qio_channel_websock_handshake_start(void *ioc) "Websock handshake start = ioc=3D%p" qio_channel_websock_handshake_pending(void *ioc, int status) "Websock ha= ndshake pending ioc=3D%p status=3D%d" qio_channel_websock_handshake_reply(void *ioc) "Websock handshake reply = ioc=3D%p" -qio_channel_websock_handshake_fail(void *ioc) "Websock handshake fail io= c=3D%p" +qio_channel_websock_handshake_fail(void *ioc, const char *msg) "Websock = handshake fail ioc=3D%p err=3D%s" qio_channel_websock_handshake_complete(void *ioc) "Websock handshake com= plete ioc=3D%p" =20 # io/channel-command.c --=20 2.13.5