daniel has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-netif/+/33326 )
Change subject: stream: Setup ofd in osmo_stream_cli_open
......................................................................
stream: Setup ofd in osmo_stream_cli_open
Don't reset the osmo_fd data in osmo_stream_cli_set_read_cb().
osmo_ss7_asp_restart() in libosmo-sccp calls
osmo_stream_cli_set_read_cb() which causes the fd to be set to -1.
osmo_stream_cli_open() which is called after that then doesn't close the
old fd and opening the new one fails.
osmo_fd priv_nr, callback and data are never modified in osmo_stream_cli
so simply use these values in osmo_stream_cli_open()
Change-Id: Id9b4db06d5ea1f29cbd1817cab3c71765ab30a53
---
M src/stream.c
1 file changed, 20 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/26/33326/1
diff --git a/src/stream.c b/src/stream.c
index d52b7a0..b6ef92f 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -859,10 +859,6 @@
{
OSMO_ASSERT(cli->mode != OSMO_STREAM_MODE_OSMO_IO);
cli->mode = OSMO_STREAM_MODE_OSMO_FD;
- cli->ofd.fd = -1;
- cli->ofd.priv_nr = 0;
- cli->ofd.cb = osmo_stream_cli_fd_cb;
- cli->ofd.data = cli;
cli->read_cb = read_cb;
}
@@ -926,7 +922,7 @@
osmo_stream_cli_reconnect(cli);
return ret;
}
- osmo_fd_setup(&cli->ofd, ret, OSMO_FD_READ | OSMO_FD_WRITE, cli->ofd.cb,
cli->ofd.data, cli->ofd.priv_nr);
+ osmo_fd_setup(&cli->ofd, ret, OSMO_FD_READ | OSMO_FD_WRITE,
osmo_stream_cli_fd_cb, cli, 0);
if (cli->flags & OSMO_STREAM_CLI_F_NODELAY) {
ret = setsockopt_nodelay(cli->ofd.fd, cli->proto, 1);
@@ -1019,7 +1015,7 @@
switch (cli->mode) {
case OSMO_STREAM_MODE_OSMO_FD:
- osmo_fd_setup(&cli->ofd, fd, OSMO_FD_READ | OSMO_FD_WRITE, cli->ofd.cb,
cli->ofd.data, cli->ofd.priv_nr);
+ osmo_fd_setup(&cli->ofd, fd, OSMO_FD_READ | OSMO_FD_WRITE,
osmo_stream_cli_fd_cb, cli, 0);
if (osmo_fd_register(&cli->ofd) < 0)
goto error_close_socket;
break;
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-netif/+/33326
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Id9b4db06d5ea1f29cbd1817cab3c71765ab30a53
Gerrit-Change-Number: 33326
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-MessageType: newchange