Przeglądaj źródła

继续编写sshd远程运维模块的client代码

niujiuru 2 tygodni temu
rodzic
commit
9fc1e30ed6
1 zmienionych plików z 14 dodań i 4 usunięć
  1. 14 4
      sshd/client/invoker.go

+ 14 - 4
sshd/client/invoker.go

@@ -13,18 +13,28 @@ var (
 	rpc_quit = "executor.close"
 )
 
+// 串行执行
 func (c *MQTTCoupler) needSerialize(method string) bool {
-	if method == rpc_ping || method == rpc_stop {
+	switch method {
+	case rpc_ping, rpc_stop:
 		return false
+	case rpc_exec, rpc_quit:
+		return true
+	default:
+		return true
 	}
-	return true
 }
 
+// 超时结束
 func (c *MQTTCoupler) needTimeoutEnd(method string) bool {
-	if method == rpc_ping || method == rpc_stop || method == rpc_quit {
+	switch method {
+	case rpc_exec:
+		return false
+	case rpc_ping, rpc_stop, rpc_quit:
+		return true
+	default:
 		return true
 	}
-	return false
 }
 
 // 心跳检测