Hello everybody,

I'm currently working on interacting flightgear with other applications. For 
this I use the generic protocol via UDP like this:

        fgfs --generic=socket,out,10,localhost,1234,udp,exchange --
generic=socket,in,10,localhost,1235,udp,exchange

where exchange.xml is my XML protocol definition. Unfortunately, the "in" 
declaration produced a never ending loop. Thus, I propose this little patch 
for inclusion in CVS.

Regards,

Mirko

diff --git a/src/Network/generic.cxx b/src/Network/generic.cxx
index a91f783..d0896f5 100644
--- a/src/Network/generic.cxx
+++ b/src/Network/generic.cxx
@@ -467,13 +467,13 @@ bool FGGeneric::process() {
                 }
             }
         } else {
-            do {
-                if (!binary_mode) {
-                    length = io->readline( buf, FG_MAX_MSG_SIZE );
-                    if ( length > 0 ) {
-                        parse_message();
-                    }
-                } else {
+            if (!binary_mode) {
+                length = io->readline( buf, FG_MAX_MSG_SIZE );
+                if ( length > 0 ) {
+                    parse_message();
+                }
+            } else {
+		do {
                     length = io->read( buf, binary_record_length );
                     if ( length == binary_record_length ) {
                         parse_message();
@@ -484,8 +484,8 @@ bool FGGeneric::process() {
                             << binary_record_length << " but received: "
                             << length);
                     }
-                }
-            } while ( length == binary_record_length );
+                } while ( length == binary_record_length );
+            }
         }
     }
     return true;
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to