aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp <pmaier@sysmocom.de>2016-12-05 19:45:37 +0100
committerPhilipp <pmaier@sysmocom.de>2016-12-05 19:45:37 +0100
commit3e1c2e66000eb6643457ae3798c6f217688aaf94 (patch)
tree3dc974ed9315cce6d2eba0a57f464d2a25422262
parent5188254b99510ec1bac3d8805ee7efba39476c49 (diff)
Draft: Automatic link recovery for unixsocket.c
-rw-r--r--src/input/unixsocket.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/input/unixsocket.c b/src/input/unixsocket.c
index 09a8cd3..22c7c09 100644
--- a/src/input/unixsocket.c
+++ b/src/input/unixsocket.c
@@ -44,15 +44,24 @@ struct unixsocket_line {
struct osmo_fd fd;
};
+static int unixsocket_line_update(struct e1inp_line *line);
+
static int ts_want_write(struct e1inp_ts *e1i_ts);
static int unixsocket_exception_cb(struct osmo_fd *bfd)
{
+ int rc;
struct e1inp_line *line = bfd->data;
LOGP(DLINP, LOGL_ERROR, "unixsocket: closing socket. Exception cb called.\n");
+
close(bfd->fd);
+ if(osmo_fd_registered(&bfd->fd))
+ osmo_fd_unregister(&bfd->fd);
+
+ //unixsocket_line_update(line);
+
return 0;
}
@@ -180,12 +189,17 @@ static int unixsocket_line_update(struct e1inp_line *line)
ret = osmo_sock_unix_init(SOCK_SEQPACKET, 0, sock_path, OSMO_SOCK_F_CONNECT);
if (ret < 0) {
+ LOGP(DLINP, LOGL_NOTICE, "unixsocket: sock init failed\n");
talloc_free(config);
return ret;
}
+ if(osmo_fd_registered(&config->fd))
+ osmo_fd_unregister(&config->fd);
+
config->fd.fd = ret;
if (osmo_fd_register(&config->fd) < 0) {
+ LOGP(DLINP, LOGL_NOTICE, "unixsocket: sock registration failed\n");
close(config->fd.fd);
return -EIO;
}