niujiuru 3 тижнів тому
батько
коміт
4e792c4541
1 змінених файлів з 3 додано та 2 видалено
  1. 3 2
      sshd/sshd.go

+ 3 - 2
sshd/sshd.go

@@ -329,6 +329,7 @@ func (c *MQTTCoupler) execOneCmd(msg mqtt.Message) {
 	// Call-?:无效, 远端调用了还不支持的-方法
 	default:
 		resp = jsonrpc2.BuildError(req, jsonrpc2.ErrMethodNotFound, "")
+		goto retp
 	}
 
 retp:
@@ -368,7 +369,7 @@ func (c *MQTTCoupler) startExecutorReaper(interval, timeout time.Duration) {
 				ce.mu.Unlock()
 
 				if expired && idle { // 超时且状态空闲时则回收
-					ce.handleClose()
+					ce.handleClose() //// 该函数不能阻塞, 否则锁
 					delete(c.executorMap, id)
 				} // end if
 			} // end for2
@@ -395,7 +396,7 @@ func (ce *clientExecutor) handleClose() error {
 
 	var err error
 	if needInterrupt {
-		err = ce.executor.Interrupt()
+		err = ce.executor.Interrupt() // 发送"Ctrl+C"
 	}
 
 	return err