libfreerdp-core: attempt TsProxyCreateTunnelReadResponse fix
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Tue, 27 Nov 2012 09:05:41 +0000 (04:05 -0500)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Tue, 27 Nov 2012 09:05:41 +0000 (04:05 -0500)
client/X11/xfreerdp.c
libfreerdp/core/rts.c
libfreerdp/core/tsg.c

index 1ac7c40..7f9a59c 100644 (file)
@@ -1098,12 +1098,13 @@ int xfreerdp_run(freerdp* instance)
                if (max_fds == 0)
                        break;
 
-               timeout.tv_sec = 5;
+               timeout.tv_sec = 1;
+               timeout.tv_usec = 0;
+
                select_status = select(max_fds + 1, &rfds_set, &wfds_set, NULL, &timeout);
 
                if (select_status == 0)
                {
-                       //freerdp_send_keep_alive(instance);
                        continue;
                }
                else if (select_status == -1)
index fd15682..5ccaeed 100644 (file)
@@ -902,6 +902,9 @@ int rts_recv_flow_control_ack_with_destination_pdu(rdpRpc* rpc, BYTE* buffer, UI
                        Destination, BytesReceived, AvailableWindow);
        printf("ChannelCookie: " RPC_UUID_FORMAT_STRING "\n", RPC_UUID_FORMAT_ARGUMENTS(ChannelCookie));
 
+       rpc->VirtualConnection->DefaultInChannel->SenderAvailableWindow =
+               AvailableWindow - (rpc->VirtualConnection->DefaultInChannel->BytesSent - BytesReceived);
+
        return 0;
 }
 
index c6ccb30..275327c 100644 (file)
@@ -268,6 +268,8 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg)
                ZeroMemory(packetCapsResponse, sizeof(TSG_PACKET_CAPS_RESPONSE));
                packet->tsgPacket.packetCapsResponse = packetCapsResponse;
 
+               printf("TSG_PACKET_TYPE_CAPS_RESPONSE\n");
+
                /* PacketQuarResponsePtr (4 bytes) */
                packetCapsResponse->pktQuarEncResponse.flags = *((UINT32*) &buffer[offset + 12]); /* Flags */
                packetCapsResponse->pktQuarEncResponse.certChainLen = *((UINT32*) &buffer[offset + 16]); /* CertChainLength */
@@ -297,15 +299,18 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg)
                        count = *((UINT32*) &buffer[offset]); /* ActualCount (4 bytes) */
                        offset += 4;
 
-                       printf("CertChain (%d)\n", ((count + 1) * 2));
-                       freerdp_hexdump(&buffer[offset], ((count + 1) * 2));
+                       printf("CertChain (%d)\n", (count * 2));
+                       freerdp_hexdump(&buffer[offset], (count * 2));
 
                        /*
                         * CertChainData is a wide character string, and the count is
                         * given in characters excluding the null terminator, therefore:
                         * size = ((count + 1) * 2)
                         */
-                       offset += ((count + 1) * 2); /* CertChainData */
+                       offset += (count * 2); /* CertChainData */
+
+                       /* 4-byte alignment */
+                       rpc_offset_align(&offset, 4);
                }
                else
                {
@@ -384,6 +389,8 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg)
                ZeroMemory(packetQuarEncResponse, sizeof(TSG_PACKET_QUARENC_RESPONSE));
                packet->tsgPacket.packetQuarEncResponse = packetQuarEncResponse;
 
+               printf("TSG_PACKET_TYPE_QUARENC_RESPONSE\n");
+
                /* PacketQuarResponsePtr (4 bytes) */
                packetQuarEncResponse->flags = *((UINT32*) &buffer[offset + 12]); /* Flags */
                packetQuarEncResponse->certChainLen = *((UINT32*) &buffer[offset + 16]); /* CertChainLength */
@@ -401,15 +408,18 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg)
                        count = *((UINT32*) &buffer[offset]); /* ActualCount (4 bytes) */
                        offset += 4;
             
-                       printf("CertChain (%d)\n", ((count + 1) * 2));
-                       freerdp_hexdump(&buffer[offset], ((count + 1) * 2));
+                       printf("CertChain (%d)\n", (count * 2));
+                       freerdp_hexdump(&buffer[offset], (count * 2));
 
                        /*
                         * CertChainData is a wide character string, and the count is
                         * given in characters excluding the null terminator, therefore:
                         * size = ((count + 1) * 2)
                         */
-                       offset += ((count + 1) * 2); /* CertChainData */
+                       offset += (count * 2); /* CertChainData */
+
+                       /* 4-byte alignment */
+                       rpc_offset_align(&offset, 4);
                }
                else
                {