Kaynağa Gözat

Merge branch 'master' into hardening_client

Conflicts:
	src/ua_securechannel.c
Stasik0 10 yıl önce
ebeveyn
işleme
88f00f4a2c

+ 1 - 1
examples/networklayer_tcp.c

@@ -575,7 +575,7 @@ ClientNetworkLayerTCP_awaitResponse(ClientNetworkLayerTCP *handle, UA_ByteString
     setsockopt(handle->sockfd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tmptv,sizeof(struct timeval));
     int ret = recv(handle->sockfd, (char*)response->data, response->length, 0);
     if(ret <= -1)
-        return UA_STATUSCODE_BADINTERNALERROR;
+    	return UA_STATUSCODE_BADINTERNALERROR;
     if(ret == 0)
         return UA_STATUSCODE_BADSERVERNOTCONNECTED;
     response->length = ret;

+ 2 - 2
src/client/ua_client.c

@@ -174,7 +174,7 @@ static UA_StatusCode SecureChannelHandshake(UA_Client *client) {
     UA_ByteString reply;
     UA_ByteString_newMembers(&reply, client->connection.localConf.recvBufferSize);
     do {
-        retval = client->networkLayer.awaitResponse(client->networkLayer.nlHandle, &reply, 1000);
+        retval = client->networkLayer.awaitResponse(client->networkLayer.nlHandle, &reply, 500 * 1000);
         if(retval != UA_STATUSCODE_GOOD) {
             UA_ByteString_deleteMembers(&reply);
             return retval;
@@ -285,7 +285,7 @@ static void sendReceiveRequest(UA_RequestHeader *request, const UA_DataType *req
     UA_ByteString reply;
     do {
         UA_ByteString_newMembers(&reply, client->connection.localConf.recvBufferSize);
-        retval = client->networkLayer.awaitResponse(client->networkLayer.nlHandle, &reply, 1000);
+        retval = client->networkLayer.awaitResponse(client->networkLayer.nlHandle, &reply, 500 * 1000);
         if(retval != UA_STATUSCODE_GOOD) {
             UA_ByteString_deleteMembers(&reply);
             respHeader->serviceResult = retval;

+ 3 - 3
src/ua_securechannel.c

@@ -60,7 +60,7 @@ UA_ByteString UA_Connection_completeMessages(UA_Connection *connection, UA_ByteS
 
     if(current.length == 0) {
         /* throw everything away */
-        UA_String_deleteMembers(&current);
+        UA_ByteString_deleteMembers(&current);
         current.length = -1;
         return current;
     }
@@ -68,8 +68,8 @@ UA_ByteString UA_Connection_completeMessages(UA_Connection *connection, UA_ByteS
     if(end_pos == 0) {
         /* no complete message in current */
         connection->incompleteMessage = current;
-        UA_String_init(current);
-    } else if(current.length != end_pos) {
+        UA_ByteString_init(&current);
+    } else if(current.length != (UA_Int32)end_pos) {
         /* there is an incomplete message at the end of current */
         connection->incompleteMessage.data = UA_malloc(current.length - end_pos);
         if(connection->incompleteMessage.data) {