From: Pablo Neira Ayuso <[email protected]>

Better close the newly established TCP connection to force a
re-establishment.
---
 src/input/ipaccess.c |   28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 31b8f04..c69ae24 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -601,15 +601,22 @@ static int ipaccess_bsc_oml_cb(struct ipa_server_link 
*link, int fd)
        ret = osmo_fd_register(bfd);
        if (ret < 0) {
                LOGP(DLINP, LOGL_ERROR, "could not register FD\n");
-               close(bfd->fd);
-               e1inp_line_put(line);
-               return ret;
+               goto err;
        }
 
        /* Request ID. FIXME: request LOCATION, HW/SW VErsion, Unit Name, Serno 
*/
        ret = ipaccess_send_id_req(bfd->fd);
+       if (ret < 0) {
+               LOGP(DLINP, LOGL_ERROR, "could not send ID REQ. Reason: %s\n",
+                       strerror(errno));
+               goto err;
+       }
 
-        return ret;
+       return ret;
+err:
+       close(bfd->fd);
+       e1inp_line_put(line);
+       return ret;
 }
 
 static int ipaccess_bsc_rsl_cb(struct ipa_server_link *link, int fd)
@@ -645,14 +652,21 @@ static int ipaccess_bsc_rsl_cb(struct ipa_server_link 
*link, int fd)
        ret = osmo_fd_register(bfd);
        if (ret < 0) {
                LOGP(DLINP, LOGL_ERROR, "could not register FD\n");
-               close(bfd->fd);
-               e1inp_line_put(line);
-               return ret;
+               goto err;
        }
        /* Request ID. FIXME: request LOCATION, HW/SW VErsion, Unit Name, Serno 
*/
        ret = ipaccess_send_id_req(bfd->fd);
+       if (ret < 0) {
+               LOGP(DLINP, LOGL_ERROR, "could not send ID REQ. Reason: %s\n",
+                       strerror(errno));
+               goto err;
+       }
 
        return 0;
+err:
+       close(bfd->fd);
+       e1inp_line_put(line);
+       return ret;
 }
 
 static struct msgb *
-- 
1.7.10.4


Reply via email to