修复多连接的问题
This commit is contained in:
@@ -25,10 +25,8 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "net_socket.h"
|
||||
#include "net_select.h"
|
||||
#include "net_task.h"
|
||||
#include "ch395f.h"
|
||||
#include "ch395f_test.h"
|
||||
#include "dbg_log.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
@@ -49,9 +47,7 @@
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Variables */
|
||||
#ifdef ENABLE_PHASE4_TESTS
|
||||
static uint8_t s_net_buf[1500];
|
||||
#endif
|
||||
|
||||
/* USER CODE END Variables */
|
||||
/* Definitions for defaultTask */
|
||||
osThreadId_t defaultTaskHandle;
|
||||
@@ -64,7 +60,7 @@ const osThreadAttr_t defaultTask_attributes = {
|
||||
osThreadId_t netTaskHandle;
|
||||
const osThreadAttr_t netTask_attributes = {
|
||||
.name = "netTask",
|
||||
.stack_size = 1024 * 4,
|
||||
.stack_size = 1024 * 8,
|
||||
.priority = (osPriority_t) osPriorityNormal,
|
||||
};
|
||||
|
||||
@@ -149,40 +145,7 @@ void StartDefaultTask(void *argument)
|
||||
void StartNetTask(void *argument)
|
||||
{
|
||||
/* USER CODE BEGIN StartNetTask */
|
||||
osDelay(2000);
|
||||
|
||||
DBG_INFO("netTask: started");
|
||||
|
||||
for(;;)
|
||||
{
|
||||
net_poll();
|
||||
|
||||
#ifdef ENABLE_PHASE4_TESTS
|
||||
for (int i = 1; i < 8; i++)
|
||||
{
|
||||
net_sock_t *sk = net_get_sock(i);
|
||||
if (sk == NULL || !sk->in_use || sk->state != NET_SOCK_STATE_ESTABLISHED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int n = net_recv(i, s_net_buf, sizeof(s_net_buf), NET_MSG_DONTWAIT);
|
||||
if (n > 0)
|
||||
{
|
||||
net_send(i, s_net_buf, n, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_PHASE5_TESTS
|
||||
ch395f_phase5_tests();
|
||||
#endif
|
||||
#ifdef ENABLE_PHASE7_TESTS
|
||||
ch395f_phase7_tests();
|
||||
#endif
|
||||
|
||||
osDelay(10);
|
||||
}
|
||||
net_task_func(argument);
|
||||
/* USER CODE END StartNetTask */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user