summaryrefslogtreecommitdiff
path: root/btio
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:01:17 +0200
commit58a1819a44dd753ea14baea64e870e754ea6d8fc (patch)
tree7433edc52c7b33c43b906ec0b9f1c378d52624dc /btio
parent5a3507c104e949048a90402ad0d946702183a42e (diff)
downloadbluez-58a1819a44dd753ea14baea64e870e754ea6d8fc.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.
Diffstat (limited to 'btio')
-rw-r--r--btio/btio.c26
1 files 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);