Revision: 41757
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41757&view=rev
Author:   davidloman
Date:     2010-12-22 13:18:51 +0000 (Wed, 22 Dec 2010)

Log Message:
-----------
Implement PongMsg handling.  Add in ability to calculate current time to the 
nearest ms and get roundtrip ping time.  Also fixed logging label errors.

Modified Paths:
--------------
    rt^3/trunk/src/GS/GSClient.cxx

Modified: rt^3/trunk/src/GS/GSClient.cxx
===================================================================
--- rt^3/trunk/src/GS/GSClient.cxx      2010-12-22 13:17:13 UTC (rev 41756)
+++ rt^3/trunk/src/GS/GSClient.cxx      2010-12-22 13:18:51 UTC (rev 41757)
@@ -98,7 +98,7 @@
 
                        QUuid re = fMsg->getReUUID();
 
-                       log->logINFO("GeometryService", "Recv'ed A FailureMsg 
with code: " +QString::number( fc) + " (" + QString::number(fc, 16)+ ")");
+                       log->logINFO("GSClient", "Recv'ed A FailureMsg with 
code: " +QString::number( fc) + " (" + QString::number(fc, 16)+ ")");
                        return true;
                }
        case PING:
@@ -107,14 +107,38 @@
 
                        if (p != NULL) {
                                QString remNodeName = p->getRemoteNodeName();
-                               log->logINFO("GeometryService", "PING from: '" 
+ remNodeName + "'");
+                               log->logINFO("GSClient", "PING from: '" + 
remNodeName + "'");
                                PongMsg pongMsg((PingMsg*)msg);
                                p->send(&pongMsg);
                        } else {
-                               log->logINFO("GeometryService", "Can't return 
ping.  NULL Portal*");
+                               log->logINFO("GSClient", "Can't return ping.  
NULL Portal*");
                        }
                }
+       case PONG:
+               {
+                       Portal* p = msg->getOrigin();
+                       PongMsg* pongMsg = (PongMsg*)msg;
 
+                       /* calc current and differential times */
+                       quint32 start = pongMsg->getStartTime();
+                       timeval tim;
+                       gettimeofday(&tim, NULL);
+                       quint32 now=(tim.tv_sec * 1000 ) + (tim.tv_usec/1000);
+                       quint32 diff = now -start;
+
+                       log->logINFO("GSClient", "Start: " + 
QString::number(start) +
+                                       ", now: " + QString::number(now) +
+                                       ", diff: " + QString::number(diff) );
+
+                       if (p != NULL) {
+                               QString remNodeName = p->getRemoteNodeName();
+                               log->logINFO("GSClient", "Pong from: '" + 
remNodeName + "'");
+                       } else {
+                               log->logINFO("GSClient", "Can't return ping.  
NULL Portal*");
+                       }
+
+                       return true;
+               }
        }
        return false;
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Forrester recently released a report on the Return on Investment (ROI) of
Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
within 7 months.  Over 3 million businesses have gone Google with Google Apps:
an online email calendar, and document program that's accessible from your 
browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to