From 58a1819a44dd753ea14baea64e870e754ea6d8fc Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Thu, 26 Jul 2012 11:11:09 -0300 Subject: [PATCH] btio: Connect callback errors handling cleanup Condition verification is not required for this watch since the condition to watch for was previously informed when it was added in the mainloop. --- btio/btio.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/btio/btio.c b/btio/btio.c index 792123f3d..730bdb322 100644 --- a/btio/btio.c +++ b/btio/btio.c @@ -162,27 +162,15 @@ static gboolean connect_cb(GIOChannel *io, GIOCondition cond, if ((cond & G_IO_NVAL) || check_nval(io)) return FALSE; - if (cond & G_IO_OUT) { - sock = g_io_channel_unix_get_fd(io); - - if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &sk_err, &len) < 0) - err = -errno; - else - err = -sk_err; - - if (err < 0) - ERROR_FAILED(&gerr, "connect", -err); - } else if (cond & (G_IO_HUP | G_IO_ERR)) { - sock = g_io_channel_unix_get_fd(io); + sock = g_io_channel_unix_get_fd(io); - if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &sk_err, &len) < 0) - err = -errno; - else - err = -sk_err; + if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &sk_err, &len) < 0) + err = -errno; + else + err = -sk_err; - if (err < 0) - ERROR_FAILED(&gerr, "HUP or ERR on socket", -err); - } + if (err < 0) + ERROR_FAILED(&gerr, "connect error", -err); conn->connect(io, gerr, conn->user_data); -- 2.47.3