This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Fork of libMiMic by Ryo Iizuka

Files at this revision

API Documentation at this revision

Comitter:
nyatla
Date:
Wed Jun 25 02:58:45 2014 +0000
Parent:
81:e5e4f2264d24
Child:
83:d46aa580722a
Commit message:
bugfix; hsgw?????WebSocket????????????????????????????????????;

Changed in this revision

core/NyLPC_cMiMicEnv.c Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/mod/NyLPC_cModWebSocket.c Show annotated file Show diff for this revision Revisions of this file
--- a/core/NyLPC_cMiMicEnv.c	Tue Jun 24 14:34:39 2014 +0000
+++ b/core/NyLPC_cMiMicEnv.c	Wed Jun 25 02:58:45 2014 +0000
@@ -1,7 +1,7 @@
 #include "NyLPC_cMiMicEnv.h"
 #include "../uip/NyLPC_cUipService_protected.h"
 
-const static char* VERSION="MiMic/1.5.7";
+const static char* VERSION="MiMic/1.5.8";
 
 #if NyLPC_MCU==NyLPC_MCU_LPC4088
 const static char* MCU="LPC4088";
--- a/core/net/httpd/mod/NyLPC_cModWebSocket.c	Tue Jun 24 14:34:39 2014 +0000
+++ b/core/net/httpd/mod/NyLPC_cModWebSocket.c	Wed Jun 25 02:58:45 2014 +0000
@@ -324,7 +324,7 @@
 void NyLPC_cModWebSocket_update(NyLPC_TcModWebSocket_t* i_inst,NyLPC_TUInt32 i_time_out)
 {
 	const NyLPC_TUInt8* rx;
-	NyLPC_TInt32 rs;
+	NyLPC_TInt32 rs,rt;
 	NyLPC_TUInt16 header_size;
 	NyLPC_TUInt8 w8[2];
 	if(i_inst->_payload_st==NyLPC_TcModWebSocket_ST_CLOSED){
@@ -382,6 +382,7 @@
 			memcpy(i_inst->_frame_mask,(rx+header_size-4),4);
 			NyLPC_TUInt8_setBit(i_inst->_frame_flags_bits,FLAGS_MASK_BIT);
 		}
+		//ペイロードポインターのリセット
 		i_inst->payload_ptr=0;
 
 		//パケットサイズの確定(基本ヘッダ+マスク)
@@ -421,7 +422,12 @@
 					//Timeout
 					goto Timeout;
 				}
-				//読み込みサイズを決定
+				//読出し可能なサイズを決定
+				rt=i_inst->payload_size-i_inst->payload_ptr;
+				if(rs>rt){
+					rs=rt;
+				}
+				//パケットを破棄
 				NyLPC_iHttpPtrStream_write(NyLPC_cHttpdConnection_refStream(i_inst->_ref_connection),rx,rs);
 				NyLPC_iHttpPtrStream_rseek(NyLPC_cHttpdConnection_refStream(i_inst->_ref_connection),rs);
 				i_inst->payload_ptr+=rs;
@@ -441,7 +447,12 @@
 					//Timeout
 					goto Timeout;
 				}
-				//読み込みサイズを決定
+				//読出し可能なサイズを決定
+				rt=i_inst->payload_size-i_inst->payload_ptr;
+				if(rs>rt){
+					rs=rt;
+				}
+				//パケットを破棄
 				NyLPC_iHttpPtrStream_rseek(NyLPC_cHttpdConnection_refStream(i_inst->_ref_connection),rs);
 				i_inst->payload_ptr+=rs;
 			}
@@ -502,7 +513,13 @@
 		//Timeout
 		goto Timeout;
 	}
-	rd=0;//読みだしたバイト数
+	//読出し可能な残りサイズを計算して上書き
+	rd=i_inst->payload_size-i_inst->payload_ptr;
+	if(rs>rd){
+		rs=rd;
+	}
+	//読みだしたバイト数をリセット
+	rd=0;
 	//アンマスク
 	if(NyLPC_TUInt8_isBitOn(i_inst->_frame_flags_bits,FLAGS_MASK_BIT)){
 		//マスク有の時