aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2012-07-26 11:11:09 -0300
committerJohan Hedberg <johan.hedberg@intel.com>2012-07-29 17:03:26 +0200
commit73bb0a0de9aace7b596d1acb71e931ac465a212f (patch)
tree4d5ac361916b64b2565f2835f3e74fe69a6237c5
parent3ca8fbc8a486fdfc1ff29a28ed6bcad95206ff94 (diff)
downloadobexd-73bb0a0de9aace7b596d1acb71e931ac465a212f.tar.gz
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.
-rw-r--r--btio/btio.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/btio/btio.c b/btio/btio.c
index 792123f..730bdb3 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);