// 发送 WebSocket 消息
-int send_websocket_message(WebSocketClient *client, const unsigned char *message, size_t message_len, WebSocketMessageType type) {
+int send_websocket_message(WebSocketClient *client, uint8_t *message, size_t message_len, WebSocketMessageType type) {
if(client==NULL||message==NULL )
{
return;
}
- if (send_websocket_message(chat_client,( const unsigned char *)jsonString,strlen(jsonString),WS_TEXT)==0)
+ if (send_websocket_message(chat_client,( uint8_t *)jsonString,strlen(jsonString),WS_TEXT)==0)
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_websocket_message succ 0\n");
else
{
char *jsonString = "{\"header\":{\"event\":\"StartTranscription\",\"trace_id\": \
\"3fa6b9e6a30b407ea38ad7ae69e6c291\"},\"payload\":{\"format\":\"MP3\",\"sample_rate\":16000}}";
- if (send_websocket_message(asr_client,( const unsigned char *)jsonString,strlen(jsonString),WS_TEXT)==0)
+ if (send_websocket_message(asr_client,( uint8_t *)jsonString,strlen(jsonString),WS_TEXT)==0)
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_websocket_message succ 0\n");
else
{
// uapi_tts_paly_init();
- if (send_websocket_message(asr_client,( const unsigned char *)jsonString,strlen(jsonString),WS_TEXT)==0)
+ if (send_websocket_message(asr_client,( uint8_t *)jsonString,strlen(jsonString),WS_TEXT)==0)
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_websocket_message succ 0\n");
else
{
-void send_ai_bin(char *buf,uint32_t len)
+void send_ai_bin(uint8_t *buf,uint32_t len)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_ai_bin %d\n",len);
- if (send_websocket_message(asr_client,( const unsigned char *)buf,len,WS_BINARY)==0)
+ if (send_websocket_message(asr_client,( uint8_t *)buf,len,WS_BINARY)==0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_websocket_message succ 0\n");
bk_sleep(100);
printf("uapi_start_tts : %s\r\n",jsonString);
- if (send_websocket_message(tts_client,( const unsigned char *)jsonString,strlen(jsonString),WS_TEXT)==0)
+ if (send_websocket_message(tts_client,( uint8_t *)jsonString,strlen(jsonString),WS_TEXT)==0)
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_websocket_message succ 0\n");
}
void uapi_start_tts_single(void)
printf("uapi_start_tts : %s\r\n",jsonString);
- if (send_websocket_message(tts_client,( const unsigned char *)jsonString,strlen(jsonString),WS_TEXT)==0)
+ if (send_websocket_message(tts_client,(uint8_t *)jsonString,strlen(jsonString),WS_TEXT)==0)
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_websocket_message succ 0\n");
}
printf("uapi_start_tts : %s\r\n",jsonString);
- if (send_websocket_message(tts_client,( const unsigned char *)jsonString,strlen(jsonString),WS_TEXT)==0)
+ if (send_websocket_message(tts_client,( uint8_t *)jsonString,strlen(jsonString),WS_TEXT)==0)
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_websocket_message succ 0\n");
free(jsonString);
}";
- if (send_websocket_message(tts_client,( const unsigned char *)jsonString,strlen(jsonString),WS_TEXT)==0)
+ if (send_websocket_message(tts_client,( uint8_t *)jsonString,strlen(jsonString),WS_TEXT)==0)
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_websocket_message succ 0\n");
else
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"send_websocket_message fail 1\n");
void asr_server_deinit(void)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"WS_CLOSE");
- send_websocket_message(asr_client,(const unsigned char *)"WS_CLOSE",strlen("WS_CLOSE"),WS_CLOSE);
+ send_websocket_message(asr_client,(uint8_t *)"WS_CLOSE",strlen("WS_CLOSE"),WS_CLOSE);
}
void chat_server_deinit(void)
{
- send_websocket_message(chat_client,(const unsigned char *)"WS_CLOSE",strlen("WS_CLOSE"),WS_CLOSE);
+ send_websocket_message(chat_client,(uint8_t *)"WS_CLOSE",strlen("WS_CLOSE"),WS_CLOSE);
}
void tts_server_deinit(void)
{
- send_websocket_message(tts_client,(const unsigned char *)"WS_CLOSE",strlen("WS_CLOSE"),WS_CLOSE);
+ send_websocket_message(tts_client,(uint8_t *)"WS_CLOSE",strlen("WS_CLOSE"),WS_CLOSE);
}
/* In the case of fast retransmit, the packet should not go to the tail
* of the unacked queue, but rather somewhere before it. We need to check for
* this case. -STJ Jul 27, 2004 */
+ // printf(" tcp_output_segment \r\n");
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /*
+ useg 被异常释放造成死机 , 后续待验证
+ */
+ if(seg==NULL)
+ {
+ printf("tcp_output_segment seg==NULL\r\n");
+ return ERR_MEM;
+ }
+
+ if(seg->tcphdr==NULL)
+ {
+ printf("tcp_output_segment seg->tcphdr=NULL\r\n");
+ return ERR_MEM;
+ }
+ if(seg->tcphdr->seqno==NULL)
+ {
+ printf("tcp_output_segment seg->tcphdr->seqno==NULL\r\n");
+ return ERR_MEM;
+ }
+
+ if(useg==NULL)
+ {
+ printf("tcp_output_segment useg==NULL \r\n");
+ return ERR_MEM;
+ }
+
+ if(useg->tcphdr==NULL)
+ {
+ printf("tcp_output_segment useg->tcphdr=NULL\r\n");
+ return ERR_MEM;
+ }
+ if(useg->tcphdr->seqno==NULL)
+ {
+ printf(" tcp_output_segment useg->tcphdr->seqno==NULL\r\n");
+ return ERR_MEM;
+ }
if (TCP_SEQ_LT(lwip_ntohl(seg->tcphdr->seqno), lwip_ntohl(useg->tcphdr->seqno))) {
+
+
/* add segment to before tail of unacked list, keeping the list sorted */
struct tcp_seg **cur_seg = &(pcb->unacked);
while (*cur_seg &&