diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-05-09 21:28:22 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-05-09 21:28:22 +0000 |
commit | c7ff83efffd73e9ca82aa29990faaa38c90bd826 (patch) | |
tree | 278350720aaf42f99261456efb993705cc935291 | |
parent | f0fe2c5ffb3741f4e6fdbe2d7aee01e66b2af4dd (diff) |
serial: handle socket errors properly - timeout waiting linkkey or other errors can happen
-rw-r--r-- | serial/manager.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/serial/manager.c b/serial/manager.c index f4480404..90637123 100644 --- a/serial/manager.c +++ b/serial/manager.c @@ -404,6 +404,12 @@ static gboolean rfcomm_connect_cb(GIOChannel *chan, int sk, ret, err, fd; socklen_t len; + if (cond & (G_IO_ERR | G_IO_HUP)) { + error("Hangup or error on rfcomm socket"); + err_connection_canceled(pc->conn, pc->msg); + goto fail; + } + if (pc->canceled) { err_connection_canceled(pc->conn, pc->msg); goto fail; @@ -512,7 +518,8 @@ static int rfcomm_connect(struct pending_connect *pc) } debug("Connect in progress"); - g_io_add_watch(io, G_IO_OUT, (GIOFunc) rfcomm_connect_cb, pc); + g_io_add_watch(io, G_IO_OUT | G_IO_ERR | G_IO_HUP, + (GIOFunc) rfcomm_connect_cb, pc); } else { debug("Connect succeeded with first try"); (void) rfcomm_connect_cb(io, G_IO_OUT, pc); |