wfreerdp-server: fixed some syncronization bugs
authorC-o-r-E <can.of.tuna@gmail.com>
Sun, 19 Aug 2012 19:46:47 +0000 (15:46 -0400)
committerC-o-r-E <can.of.tuna@gmail.com>
Sun, 19 Aug 2012 19:46:47 +0000 (15:46 -0400)
server/Windows/wf_info.c
server/Windows/wf_info.h
server/Windows/wf_peer.c

index 2f23722..66f6e04 100644 (file)
@@ -238,3 +238,10 @@ void wf_info_clear_invalid_region(wfInfo* info)
        info->invalid_y2 = 0;\r
        ReleaseMutex(info->mutex);\r
 }\r
+\r
+BOOL wf_info_have_invalid_region(wfInfo* info)\r
+{\r
+       if((info->invalid_x1 >= info->invalid_x2) || (info->invalid_y1 >= info->invalid_y2))\r
+               return false;\r
+       return true;\r
+}
\ No newline at end of file
index 5755ece..cd940f9 100644 (file)
@@ -63,6 +63,7 @@ void wf_info_updated(wfInfo* info);
 void wf_info_update_changes(wfInfo* info);\r
 void wf_info_find_invalid_region(wfInfo* info);\r
 void wf_info_clear_invalid_region(wfInfo* info);\r
+BOOL wf_info_have_invalid_region(wfInfo* info);\r
 \r
 \r
 #endif
\ No newline at end of file
index 599c1c3..05e0337 100644 (file)
@@ -166,11 +166,11 @@ void wf_rfx_encode(freerdp_peer* client)
        buf = (GETCHANGESBUF*)wfi->changeBuffer;\r
 \r
        \r
-       if( (wfp->activated == false) )//||             ( (wfi->nextUpdate - wfi->lastUpdate) == 0) )\r
+       if( (wfp->activated == false) || (wf_info_has_subscribers(wfi) == false) )\r
                return;\r
 \r
-       if ( (wfi->invalid_x1 >= wfi->invalid_x2) || (wfi->invalid_y1 >= wfi->invalid_y2) )\r
-                       return;\r
+       if ( !wf_info_have_invalid_region(wfi) )\r
+               return;\r
 \r
        dRes = WaitForSingleObject(wfInfoSingleton->encodeMutex, INFINITE);\r
        switch(dRes)\r
@@ -322,7 +322,7 @@ void wf_peer_send_changes(rdpUpdate* update)
        {\r
        case WAIT_OBJECT_0:\r
                //are there changes to send?\r
-               if(!wf_info_have_updates(wfInfoSingleton))\r
+               if( !wf_info_have_updates(wfInfoSingleton) || !wf_info_have_invalid_region(wfInfoSingleton) )\r
                {\r
                        ReleaseMutex(wfInfoSingleton->encodeMutex);\r
                        break;\r
@@ -332,7 +332,7 @@ void wf_peer_send_changes(rdpUpdate* update)
                wf_info_updated(wfInfoSingleton);\r
                printf("\tSend...\n");\r
                update->SurfaceBits(update->context, &update->surface_bits_command);\r
-\r
+               //wf_info_clear_invalid_region(wfInfoSingleton);\r
                ReleaseMutex(wfInfoSingleton->encodeMutex);\r
                break;\r
 \r