From: Sean Hefty Date: Mon, 21 May 2012 23:39:46 +0000 (-0700) Subject: rstream: Check for connection error on async connect X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=2d28d3ac1d7536a7ea2e699388b28df61455da6b;p=~shefty%2Flibrdmacm.git rstream: Check for connection error on async connect Signed-off-by: Sean Hefty --- diff --git a/examples/rstream.c b/examples/rstream.c index 104b318a..c440f04c 100644 --- a/examples/rstream.c +++ b/examples/rstream.c @@ -448,7 +448,8 @@ static int client_connect(void) { struct addrinfo *res; struct pollfd fds; - int ret, rs; + int ret, rs, err; + socklen_t len; ret = getaddrinfo(dst_addr, port, NULL, &res); if (ret) { @@ -477,6 +478,17 @@ static int client_connect(void) ret = do_poll(&fds); if (ret) goto err; + + len = sizeof err; + ret = rs_getsockopt(rs, SOL_SOCKET, SO_ERROR, &err, &len); + if (ret) + goto err; + if (err) { + ret = -1; + errno = err; + perror("async rconnect"); + goto err; + } } free: