소스 검색

Merge pull request #4006 from qiyongzhong0/fix_at_client

fix at_client, avoid creating the same client repeatedly and prevent …
Bernard Xiong 4 년 전
부모
커밋
ac6da8d4cf
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      components/net/at/src/at_client.c

+ 5 - 0
components/net/at/src/at_client.c

@@ -917,6 +917,11 @@ int at_client_init(const char *dev_name,  rt_size_t recv_bufsz)
     RT_ASSERT(dev_name);
     RT_ASSERT(recv_bufsz > 0);
 
+    if (at_client_get(dev_name) != RT_NULL)
+    {
+        return result;
+    }
+
     for (idx = 0; idx < AT_CLIENT_NUM_MAX && at_client_table[idx].device; idx++);
 
     if (idx >= AT_CLIENT_NUM_MAX)