chore(connection): remove connecting state

This commit is contained in:
fengzero
2022-08-12 07:06:16 +00:00
parent 373641bbe0
commit 3d87ab63da
6 changed files with 11 additions and 13 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ Modbus Test Setup
${state}= Get Node State ${modbus_node}
Should Be Equal As Integers ${state}[running] ${NODE_STATE_RUNNING}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED}
Modbus Test Teardown
Del Node ${modbus_node}
+6 -6
View File
@@ -37,7 +37,7 @@ Start the configured node, it should return success
Node Setting modbus-node ${MODBUS_TCP_CONFIG}
${state} = Get Node State modbus-node
Should Be Equal As Integers ${state}[running] ${NODE_STATE_READY}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED}
${res} = Node Ctl modbus-node ${NODE_CTL_START}
Check Response Status ${res} 200
@@ -45,7 +45,7 @@ Start the configured node, it should return success
#${state} = Get Node State modbus-node
#Should Be Equal As Integers ${state}[running] ${NODE_STATE_RUNNING}
#Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING}
#Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED}
${res} = Node Ctl modbus-node ${NODE_CTL_STOP}
Check Response Status ${res} 200
@@ -53,7 +53,7 @@ Start the configured node, it should return success
${state} = Get Node State modbus-node
Should Be Equal As Integers ${state}[running] ${NODE_STATE_STOP}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED}
Stop node that is stopped, it should return failure
${res} = Node Ctl modbus-node ${NODE_CTL_STOP}
@@ -67,7 +67,7 @@ Start the stopped node, it should return success
${state} = Get Node State modbus-node
Should Be Equal As Integers ${state}[running] ${NODE_STATE_RUNNING}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED}
Start the running node, it should return failure
${res} = Node Ctl modbus-node ${NODE_CTL_START}
@@ -79,7 +79,7 @@ When setting up a READY/RUNNING/STOPED node, the node status will not change
${state} = Get Node State modbus-node
Should Be Equal As Integers ${state}[running] ${NODE_STATE_RUNNING}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED}
${res} = Node Ctl modbus-node ${NODE_CTL_STOP}
Check Response Status ${res} 200
@@ -89,6 +89,6 @@ When setting up a READY/RUNNING/STOPED node, the node status will not change
${state} = Get Node State modbus-node
Should Be Equal As Integers ${state}[running] ${NODE_STATE_STOP}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING}
Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED}
[Teardown] Del Node modbus-node
+1 -2
View File
@@ -17,8 +17,7 @@ ${NODE_STATE_RUNNING} 3
${NODE_STATE_STOP} 4
${NODE_LINK_STATE_DISCONNECTED} 0
${NODE_LINK_STATE_CONNECTING} 1
${NODE_LINK_STATE_CONNECTED} 2
${NODE_LINK_STATE_CONNECTED} 1
${NODE_CTL_START} 0
${NODE_CTL_STOP} 1
+1 -2
View File
@@ -47,8 +47,7 @@ typedef enum {
typedef enum {
NEU_NODE_LINK_STATE_DISCONNECTED = 0,
NEU_NODE_LINK_STATE_CONNECTING = 1,
NEU_NODE_LINK_STATE_CONNECTED = 2,
NEU_NODE_LINK_STATE_CONNECTED = 1,
} neu_node_link_state_e;
typedef enum {
+1 -1
View File
@@ -147,7 +147,7 @@ static int driver_config(neu_plugin_t *plugin, const char *config)
plog_info(plugin, "config: host: %s, port: %" PRId64 ", timeout: %" PRId64,
host.v.val_str, port.v.val_int, timeout.v.val_int);
plugin->common.link_state = NEU_NODE_LINK_STATE_CONNECTING;
plugin->common.link_state = NEU_NODE_LINK_STATE_DISCONNECTED;
if (plugin->conn != NULL) {
plugin->conn = neu_conn_reconfig(plugin->conn, &param);
} else {
+1 -1
View File
@@ -415,7 +415,7 @@ static int plguin_start_running(neu_plugin_t *plugin)
plugin->routine = routine;
plugin->running = true;
plugin->common.link_state = NEU_NODE_LINK_STATE_CONNECTING;
plugin->common.link_state = NEU_NODE_LINK_STATE_DISCONNECTED;
}
return 0;