aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-01-28 13:17:56 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-01-28 13:19:53 +0100
commit97c3226e909c53582a91ee82e7880c6ca0b1344a (patch)
treeb37e0e8343537fa5b7f76ca430457353db0dcd3a
parent7f8e0502e2b5692441fb8c281ef5556172591883 (diff)
stream: Rename cli state NONE to CLOSEDpespin/fix
It makes a lot more sense calling it this way since it matches the state of the stream at that point. Change-Id: Ic02aec3f7f095e0e0e1f940425f577be5048e98f
-rw-r--r--src/stream.c10
-rw-r--r--tests/stream/stream_test.err2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/stream.c b/src/stream.c
index 8a063f2..65532d3 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -129,7 +129,7 @@ static int setsockopt_nodelay(int fd, int proto, int on)
*/
enum osmo_stream_cli_state {
- STREAM_CLI_STATE_NONE, /* No fd associated, no timer active */
+ STREAM_CLI_STATE_CLOSED, /* No fd associated, no timer active */
STREAM_CLI_STATE_WAIT_RECONNECT, /* No fd associated, has timer active to try to connect again */
STREAM_CLI_STATE_CONNECTING, /* Fd associated, but connection not yet confirmed by peer or lower layers */
STREAM_CLI_STATE_CONNECTED, /* Fd associated and connection is established */
@@ -137,7 +137,7 @@ enum osmo_stream_cli_state {
};
static const struct value_string stream_cli_state_names[] = {
- { STREAM_CLI_STATE_NONE, "NONE" },
+ { STREAM_CLI_STATE_CLOSED, "CLOSED" },
{ STREAM_CLI_STATE_WAIT_RECONNECT, "WAIT_RECONNECT" },
{ STREAM_CLI_STATE_CONNECTING, "CONNECTING" },
{ STREAM_CLI_STATE_CONNECTED, "CONNECTED" },
@@ -221,7 +221,7 @@ void osmo_stream_cli_close(struct osmo_stream_cli *cli)
cli->disconnect_cb(cli);
}
- cli->state = STREAM_CLI_STATE_NONE;
+ cli->state = STREAM_CLI_STATE_CLOSED;
}
static void osmo_stream_cli_read(struct osmo_stream_cli *cli)
@@ -351,7 +351,7 @@ struct osmo_stream_cli *osmo_stream_cli_create(void *ctx)
cli->ofd.priv_nr = 0; /* XXX */
cli->ofd.cb = osmo_stream_cli_fd_cb;
cli->ofd.data = cli;
- cli->state = STREAM_CLI_STATE_NONE;
+ cli->state = STREAM_CLI_STATE_CLOSED;
osmo_timer_setup(&cli->timer, cli_timer_cb, cli);
cli->reconnect_timeout = 5; /* default is 5 seconds. */
INIT_LLIST_HEAD(&cli->tx_queue);
@@ -672,7 +672,7 @@ int osmo_stream_cli_open(struct osmo_stream_cli *cli)
return 0;
error_close_socket:
- cli->state = STREAM_CLI_STATE_NONE;
+ cli->state = STREAM_CLI_STATE_CLOSED;
close(cli->ofd.fd);
cli->ofd.fd = -1;
return -EIO;
diff --git a/tests/stream/stream_test.err b/tests/stream/stream_test.err
index 69a0b85..0d08c67 100644
--- a/tests/stream/stream_test.err
+++ b/tests/stream/stream_test.err
@@ -38,6 +38,6 @@ connection closed with srv
{11.000018} non-reconnecting test step 1 [client OK, server OK], FD reg 1
[CONNECTED] osmo_stream_cli_recv(): connection closed with srv
-[NONE] osmo_stream_cli_reconnect(): not reconnecting, disabled.
+[CLOSED] osmo_stream_cli_reconnect(): not reconnecting, disabled.
{20.000019} non-reconnecting test step 0 [client OK, server OK], FD reg 0