Procházet zdrojové kódy

the watchdog bug seems to be fixed as outlined in #90

Stasik0 před 10 roky
rodič
revize
b8b8c9aae4
2 změnil soubory, kde provedl 23 přidání a 21 odebrání
  1. 21 19
      src/ua_transport_binary.c
  2. 2 2
      src/ua_transport_binary_secure.c

+ 21 - 19
src/ua_transport_binary.c

@@ -94,26 +94,28 @@ UA_Int32 TL_Process(TL_Connection* connection, const UA_ByteString* msg) {
 	UA_OPCUATcpMessageHeader tcpMessageHeader;
 
 	DBG_VERBOSE(printf("TL_Process - entered \n"));
-	if ((retval = UA_OPCUATcpMessageHeader_decodeBinary(msg,&pos,&tcpMessageHeader)) == UA_SUCCESS) {
-		printf("TL_Process - messageType=%.*s\n",3,msg->data);
-		switch(tcpMessageHeader.messageType) {
-		case UA_MESSAGETYPE_HEL:
-			retval = TL_handleHello(connection, msg, &pos);
-			break;
-		case UA_MESSAGETYPE_OPN:
-			retval = TL_handleOpen(connection, msg, &pos);
-			break;
-		case UA_MESSAGETYPE_MSG:
-			retval = TL_handleMsg(connection, msg, &pos);
-			break;
-		case UA_MESSAGETYPE_CLO:
-			retval = TL_handleClo(connection, msg, &pos);
-			break;
-		default: // dispatch processing to secureLayer
-			retval = UA_ERR_INVALID_VALUE;
-			break;
+	do{
+		if ((retval = UA_OPCUATcpMessageHeader_decodeBinary(msg,&pos,&tcpMessageHeader)) == UA_SUCCESS) {
+			printf("TL_Process - messageType=%.*s\n",3,msg->data);
+			switch(tcpMessageHeader.messageType) {
+			case UA_MESSAGETYPE_HEL:
+				retval = TL_handleHello(connection, msg, &pos);
+				break;
+			case UA_MESSAGETYPE_OPN:
+				retval = TL_handleOpen(connection, msg, &pos);
+				break;
+			case UA_MESSAGETYPE_MSG:
+				retval = TL_handleMsg(connection, msg, &pos);
+				break;
+			case UA_MESSAGETYPE_CLO:
+				retval = TL_handleClo(connection, msg, &pos);
+				break;
+			default: // dispatch processing to secureLayer
+				retval = UA_ERR_INVALID_VALUE;
+				break;
+			}
 		}
-	}
+	}while(msg->length > (UA_Int32)pos);
 	/* if (retval != UA_SUCCESS) { */
 	/* 	// FIXME: compose real error message */
 	/* 	UA_ByteString errorMsg; */

+ 2 - 2
src/ua_transport_binary_secure.c

@@ -101,9 +101,9 @@ static void init_response_header(UA_RequestHeader const *p, UA_ResponseHeader *r
     DBG_VERBOSE(printf("Invoke Service: %s\n", # TYPE));                             \
     Service_##TYPE(channel, &p, &r);                                                 \
     DBG_VERBOSE(printf("Finished Service: %s\n", # TYPE));                           \
-    *offset = 0;                                                                     \
+    UA_UInt32 sending_offset = 0;													 \
     UA_ByteString_newMembers(&response_msg, UA_##TYPE##Response_calcSizeBinary(&r)); \
-    UA_##TYPE##Response_encodeBinary(&r, &response_msg, offset);                     \
+    UA_##TYPE##Response_encodeBinary(&r, &response_msg, &sending_offset);            \
     UA_##TYPE##Request_deleteMembers(&p);                                            \
     UA_##TYPE##Response_deleteMembers(&r);                                           \