iowfehu;gdbjwHJAOPIHO?L
Fork of X_NUCLEO_IDW01M1 by
Diff: Spwf/wifi_module.c
- Revision:
- 10:e97284ae55f1
- Parent:
- 8:0f302a13e21b
- Child:
- 11:67a8c3499caf
diff -r d2dfbf8e7f49 -r e97284ae55f1 Spwf/wifi_module.c --- a/Spwf/wifi_module.c Fri May 13 06:59:56 2016 +0000 +++ b/Spwf/wifi_module.c Fri May 13 07:43:12 2016 +0000 @@ -1330,18 +1330,29 @@ if(status_flag.enable_sock_read && status_flag.Q_Contains_Message && !status_flag.message_pending) { //printf((const char*)&process_buffer[0]); - status_flag.Q_Contains_Message = WIFI_FALSE; - message_size = SockON_Data_Length;//Total size - chunk_size = Fillptr; - memcpy(UserDataBuff, process_buffer, Fillptr); - Fillptr = 0; - SockON_Data_Length = SockON_Data_Length - Fillptr; - process_buffer_index = 5; - pop_queue_length = 0; - Stop_Dequeue(); - memset(process_buffer, 0x00, Fillptr); - status_flag.Pending_SockON_Callback = WIFI_TRUE; //set this to callback to user with User Buffer pointer - + status_flag.Q_Contains_Message = WIFI_FALSE; + message_size = SockON_Data_Length; + chunk_size = Fillptr; + memcpy(UserDataBuff, process_buffer, Fillptr); + memset(process_buffer,0x00,Fillptr); + SockON_Data_Length = SockON_Data_Length - Fillptr; + Fillptr = 0; + pop_queue_length = 0; + + /* data is D Q'ed in pop_buffer and we return from here(process_buffer()) without processing this data. Next time we enter in this procedure the data will be overe written in pop_buffer + To avoid this, rewinding is necessary. */ + if(pop_buffer_size) + { + __disable_irq(); + rewind_buffer_queue(&big_buff,pop_buffer_size); //in this the case of rewinding past the buffer->end can happen + __enable_irq(); + memset(ptr, 0x00, pop_buffer_size); + pop_buffer_size = 0; + } + + Stop_Dequeue(); + status_flag.Pending_SockON_Callback = WIFI_TRUE; //set this to callback to user with User Buffer pointer + return; } //if in data mode, reset on \r\n @@ -1542,7 +1553,7 @@ Fillptr = Fillptr - databytes; } chunk_size = Fillptr; - message_size = SockON_Data_Length; + message_size = Socket_Data_Length; memcpy(UserDataBuff, process_buffer, Fillptr); Fillptr = 0; sock_total_count = 0;