[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email ) Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Introduce generic osmo_stream_{cli,srv}_get_fd() API The old osmo_stream_{cli,srv}_get_ofd() API only works for streams in OSMO_FD mode. However, it is legitimate for an application wanting to get low-level access to the file descriptor, for example to issue some {get,set}sockopt() calls on it. Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Related: OS#5753 --- M include/osmocom/netif/stream.h M src/stream_cli.c M src/stream_srv.c 3 files changed, 45 insertions(+), 6 deletions(-) Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h index a24244c..218b635 100644 --- a/include/osmocom/netif/stream.h +++ b/include/osmocom/netif/stream.h @@ -64,6 +64,7 @@ void *osmo_stream_srv_get_data(struct osmo_stream_srv *conn); struct osmo_stream_srv_link *osmo_stream_srv_get_master(struct osmo_stream_srv *conn); struct osmo_fd *osmo_stream_srv_get_ofd(struct osmo_stream_srv *srv); +int osmo_stream_srv_get_fd(const struct osmo_stream_srv *srv); void osmo_stream_srv_destroy(struct osmo_stream_srv *conn); void osmo_stream_srv_set_flush_and_destroy(struct osmo_stream_srv *conn); @@ -96,6 +97,7 @@ void *osmo_stream_cli_get_data(struct osmo_stream_cli *cli); char *osmo_stream_cli_get_sockname(const struct osmo_stream_cli *cli); struct osmo_fd *osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli); +int osmo_stream_cli_get_fd(const struct osmo_stream_cli *cli); void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int (*connect_cb)(struct osmo_stream_cli *cli)); void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, int (*disconnect_cb)(struct osmo_stream_cli *cli)); void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int (*read_cb)(struct osmo_stream_cli *cli)); diff --git a/src/stream_cli.c b/src/stream_cli.c index ef571cc..1e7ebeb 100644 --- a/src/stream_cli.c +++ b/src/stream_cli.c @@ -210,7 +210,11 @@ } } -static inline int osmo_stream_cli_fd(const struct osmo_stream_cli *cli) +/*! \brief Get file descriptor of the stream client socket + * \param[in] cli Stream Client of which we want to obtain the file descriptor + * \returns File descriptor or negative in case of error */ +int +osmo_stream_cli_get_fd(const struct osmo_stream_cli *cli) { switch (cli->mode) { case OSMO_STREAM_MODE_OSMO_FD: @@ -314,7 +318,7 @@ #ifdef SO_NOSIGPIPE int ret; int val = 1; - ret = setsockopt(osmo_stream_cli_fd(cli), SOL_SOCKET, SO_NOSIGPIPE, (void *)&val, sizeof(val)); + ret = setsockopt(osmo_stream_cli_get_fd(cli), SOL_SOCKET, SO_NOSIGPIPE, (void *)&val, sizeof(val)); if (ret < 0) LOGSCLI(cli, LOGL_ERROR, "Failed setting SO_NOSIGPIPE: %s\n", strerror(errno)); return ret; @@ -328,7 +332,7 @@ int error, ret = res; socklen_t len = sizeof(error); - int fd = osmo_stream_cli_fd(cli); + int fd = osmo_stream_cli_get_fd(cli); OSMO_ASSERT(fd >= 0); if (ret < 0) { @@ -347,7 +351,7 @@ osmo_fd_write_disable(&cli->ofd); /* Update sockname based on socket info: */ - osmo_sock_get_name_buf(cli->sockname, sizeof(cli->sockname), osmo_stream_cli_fd(cli)); + osmo_sock_get_name_buf(cli->sockname, sizeof(cli->sockname), osmo_stream_cli_get_fd(cli)); LOGSCLI(cli, LOGL_INFO, "connection established\n"); cli->state = STREAM_CLI_STATE_CONNECTED; @@ -683,7 +687,7 @@ { static char buf[OSMO_SOCK_NAME_MAXLEN]; - osmo_sock_get_name_buf(buf, OSMO_SOCK_NAME_MAXLEN, osmo_stream_cli_fd(cli)); + osmo_sock_get_name_buf(buf, OSMO_SOCK_NAME_MAXLEN, osmo_stream_cli_get_fd(cli)); return buf; } @@ -837,7 +841,7 @@ int ret, fd = -1; /* we are reconfiguring this socket, close existing first. */ - if ((cli->flags & OSMO_STREAM_CLI_F_RECONF) && osmo_stream_cli_fd(cli) >= 0) + if ((cli->flags & OSMO_STREAM_CLI_F_RECONF) && osmo_stream_cli_get_fd(cli) >= 0) osmo_stream_cli_close(cli); cli->flags &= ~OSMO_STREAM_CLI_F_RECONF; diff --git a/src/stream_srv.c b/src/stream_srv.c index 36e21cc..42b04ad 100644 --- a/src/stream_srv.c +++ b/src/stream_srv.c @@ -838,6 +838,24 @@ return &conn->ofd; } +/*! \brief Get File Descriptor of the stream server + * \param[in] conn Stream Server + * \returns file descriptor or negative on error */ +int +osmo_stream_srv_get_fd(const struct osmo_stream_srv *conn) +{ + switch (conn->mode) { + case OSMO_STREAM_MODE_OSMO_FD: + return conn->ofd.fd; + case OSMO_STREAM_MODE_OSMO_IO: +
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
Attention is currently required from: daniel. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email ) Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Patch Set 3: Code-Review+2 (1 comment) Patchset: PS3: re-adding daniels +1 from patch version 1 (only cosmetic changes since) -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Gerrit-Change-Number: 35072 Gerrit-PatchSet: 3 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Attention: daniel Gerrit-Comment-Date: Wed, 22 Nov 2023 12:21:07 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
Attention is currently required from: daniel, laforge. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email ) Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Gerrit-Change-Number: 35072 Gerrit-PatchSet: 3 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: fixeria Gerrit-Attention: laforge Gerrit-Attention: daniel Gerrit-Comment-Date: Tue, 21 Nov 2023 19:26:09 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
Attention is currently required from: daniel, fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email ) Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Patch Set 2: (2 comments) File src/stream_cli.c: https://gerrit.osmocom.org/c/libosmo-netif/+/35072/comment/1b1d7c50_9bab7d38 PS1, Line 214: to modify > I guess I meant to say that this comment is not actually related to this > function, because the `*cli […] Done https://gerrit.osmocom.org/c/libosmo-netif/+/35072/comment/d6d3a9e0_70e3d1f8 PS1, Line 215: File descriptor > `... […] Done -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Gerrit-Change-Number: 35072 Gerrit-PatchSet: 2 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-CC: fixeria Gerrit-Attention: fixeria Gerrit-Attention: daniel Gerrit-Comment-Date: Tue, 21 Nov 2023 19:25:31 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge Comment-In-Reply-To: fixeria Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
Attention is currently required from: daniel, laforge. Hello Jenkins Builder, daniel, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Introduce generic osmo_stream_{cli,srv}_get_fd() API The old osmo_stream_{cli,srv}_get_ofd() API only works for streams in OSMO_FD mode. However, it is legitimate for an application wanting to get low-level access to the file descriptor, for example to issue some {get,set}sockopt() calls on it. Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Related: OS#5753 --- M include/osmocom/netif/stream.h M src/stream_cli.c M src/stream_srv.c 3 files changed, 45 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/72/35072/3 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Gerrit-Change-Number: 35072 Gerrit-PatchSet: 3 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-CC: fixeria Gerrit-Attention: laforge Gerrit-Attention: daniel Gerrit-MessageType: newpatchset
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
Attention is currently required from: daniel, laforge. Hello Jenkins Builder, daniel, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Code-Review+1 by daniel, Verified+1 by Jenkins Builder Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Introduce generic osmo_stream_{cli,srv}_get_fd() API The old osmo_stream_{cli,srv}_get_ofd() API only works for streams in OSMO_FD mode. However, it is legitimate for an application wanting to get low-level access to the file descriptor, for example to issue some {get,set}sockopt() calls on it. Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Related: OS#5753 --- M include/osmocom/netif/stream.h M src/stream_cli.c M src/stream_srv.c 3 files changed, 45 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/72/35072/2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Gerrit-Change-Number: 35072 Gerrit-PatchSet: 2 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-CC: fixeria Gerrit-Attention: laforge Gerrit-Attention: daniel Gerrit-MessageType: newpatchset
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
Attention is currently required from: laforge. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email ) Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Patch Set 1: (1 comment) File src/stream_cli.c: https://gerrit.osmocom.org/c/libosmo-netif/+/35072/comment/560981c4_9b387fcc PS1, Line 214: to modify > well, I am turning the function from a static function into a public API, and > at the same time I'm f […] I guess I meant to say that this comment is not actually related to this function, because the `*cli` argument is const and you're are actually not modifying it. Sorry for confusion :) -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Gerrit-Change-Number: 35072 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-CC: fixeria Gerrit-Attention: laforge Gerrit-Comment-Date: Tue, 21 Nov 2023 19:24:03 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge Comment-In-Reply-To: fixeria Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email ) Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Patch Set 1: (1 comment) File src/stream_cli.c: https://gerrit.osmocom.org/c/libosmo-netif/+/35072/comment/1ba29dbd_50cf8de2 PS1, Line 214: to modify > unrelated? well, I am turning the function from a static function into a public API, and at the same time I'm fixing its documentation (which is now more relevant for public API). I wouldn't call that unrelated. -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Gerrit-Change-Number: 35072 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-CC: fixeria Gerrit-Attention: fixeria Gerrit-Comment-Date: Tue, 21 Nov 2023 19:19:27 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: fixeria Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
Attention is currently required from: laforge. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email ) Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Patch Set 1: (2 comments) File src/stream_cli.c: https://gerrit.osmocom.org/c/libosmo-netif/+/35072/comment/0c640730_d73060b5 PS1, Line 214: to modify unrelated? https://gerrit.osmocom.org/c/libosmo-netif/+/35072/comment/8d13a6fe_eb824e47 PS1, Line 215: File descriptor `... or negative on error` -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Gerrit-Change-Number: 35072 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-CC: fixeria Gerrit-Attention: laforge Gerrit-Comment-Date: Mon, 20 Nov 2023 15:54:46 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
Attention is currently required from: laforge. daniel has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email ) Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Patch Set 1: Code-Review+1 (1 comment) Patchset: PS1: Interesting, I thought we already had that API -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Gerrit-Change-Number: 35072 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Attention: laforge Gerrit-Comment-Date: Mon, 20 Nov 2023 13:09:52 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: Introduce generic osmo_stream_{cli,srv}_get_fd() API
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/35072?usp=email ) Change subject: Introduce generic osmo_stream_{cli,srv}_get_fd() API .. Introduce generic osmo_stream_{cli,srv}_get_fd() API The old osmo_stream_{cli,srv}_get_ofd() API only works for streams in OSMO_FD mode. However, it is legitimate for an application wanting to get low-level access to the file descriptor, for example to issue some {get,set}sockopt() calls on it. Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Related: OS#5753 --- M include/osmocom/netif/stream.h M src/stream_cli.c M src/stream_srv.c 3 files changed, 45 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/72/35072/1 diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h index a24244c..218b635 100644 --- a/include/osmocom/netif/stream.h +++ b/include/osmocom/netif/stream.h @@ -64,6 +64,7 @@ void *osmo_stream_srv_get_data(struct osmo_stream_srv *conn); struct osmo_stream_srv_link *osmo_stream_srv_get_master(struct osmo_stream_srv *conn); struct osmo_fd *osmo_stream_srv_get_ofd(struct osmo_stream_srv *srv); +int osmo_stream_srv_get_fd(const struct osmo_stream_srv *srv); void osmo_stream_srv_destroy(struct osmo_stream_srv *conn); void osmo_stream_srv_set_flush_and_destroy(struct osmo_stream_srv *conn); @@ -96,6 +97,7 @@ void *osmo_stream_cli_get_data(struct osmo_stream_cli *cli); char *osmo_stream_cli_get_sockname(const struct osmo_stream_cli *cli); struct osmo_fd *osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli); +int osmo_stream_cli_get_fd(const struct osmo_stream_cli *cli); void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int (*connect_cb)(struct osmo_stream_cli *cli)); void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, int (*disconnect_cb)(struct osmo_stream_cli *cli)); void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int (*read_cb)(struct osmo_stream_cli *cli)); diff --git a/src/stream_cli.c b/src/stream_cli.c index ef571cc..6769051 100644 --- a/src/stream_cli.c +++ b/src/stream_cli.c @@ -210,7 +210,11 @@ } } -static inline int osmo_stream_cli_fd(const struct osmo_stream_cli *cli) +/*! \brief Get File Descriptor of the stream client socket + * \param[in] cli Stream Client to modify + * \returns File descriptor */ +int +osmo_stream_cli_get_fd(const struct osmo_stream_cli *cli) { switch (cli->mode) { case OSMO_STREAM_MODE_OSMO_FD: @@ -314,7 +318,7 @@ #ifdef SO_NOSIGPIPE int ret; int val = 1; - ret = setsockopt(osmo_stream_cli_fd(cli), SOL_SOCKET, SO_NOSIGPIPE, (void *)&val, sizeof(val)); + ret = setsockopt(osmo_stream_cli_get_fd(cli), SOL_SOCKET, SO_NOSIGPIPE, (void *)&val, sizeof(val)); if (ret < 0) LOGSCLI(cli, LOGL_ERROR, "Failed setting SO_NOSIGPIPE: %s\n", strerror(errno)); return ret; @@ -328,7 +332,7 @@ int error, ret = res; socklen_t len = sizeof(error); - int fd = osmo_stream_cli_fd(cli); + int fd = osmo_stream_cli_get_fd(cli); OSMO_ASSERT(fd >= 0); if (ret < 0) { @@ -347,7 +351,7 @@ osmo_fd_write_disable(&cli->ofd); /* Update sockname based on socket info: */ - osmo_sock_get_name_buf(cli->sockname, sizeof(cli->sockname), osmo_stream_cli_fd(cli)); + osmo_sock_get_name_buf(cli->sockname, sizeof(cli->sockname), osmo_stream_cli_get_fd(cli)); LOGSCLI(cli, LOGL_INFO, "connection established\n"); cli->state = STREAM_CLI_STATE_CONNECTED; @@ -683,7 +687,7 @@ { static char buf[OSMO_SOCK_NAME_MAXLEN]; - osmo_sock_get_name_buf(buf, OSMO_SOCK_NAME_MAXLEN, osmo_stream_cli_fd(cli)); + osmo_sock_get_name_buf(buf, OSMO_SOCK_NAME_MAXLEN, osmo_stream_cli_get_fd(cli)); return buf; } @@ -837,7 +841,7 @@ int ret, fd = -1; /* we are reconfiguring this socket, close existing first. */ - if ((cli->flags & OSMO_STREAM_CLI_F_RECONF) && osmo_stream_cli_fd(cli) >= 0) + if ((cli->flags & OSMO_STREAM_CLI_F_RECONF) && osmo_stream_cli_get_fd(cli) >= 0) osmo_stream_cli_close(cli); cli->flags &= ~OSMO_STREAM_CLI_F_RECONF; diff --git a/src/stream_srv.c b/src/stream_srv.c index 36e21cc..42b04ad 100644 --- a/src/stream_srv.c +++ b/src/stream_srv.c @@ -838,6 +838,24 @@ return &conn->ofd; } +/*! \brief Get File Descriptor of the stream server + * \param[in] conn Stream Server + * \returns file descriptor or negative on error */ +int +osmo_stream_srv_get_fd(const struct osmo_stream_srv *conn) +{ + switch (conn->mode) { + case OSMO_STREAM_MODE_OSMO_FD: + return conn->ofd.fd; + case OSMO_STREAM_MODE_OSMO_IO: + if (conn->iofd) + return osmo_iofd_get_fd(conn->iofd); + default: +