gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/rtmp r9733: add the cache and gather stati


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9733: add the cache and gather statistics.
Date: Fri, 14 Nov 2008 20:36:20 -0700
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9733
committer: address@hidden
branch nick: rtmp
timestamp: Fri 2008-11-14 20:36:20 -0700
message:
  add the cache and gather statistics.
modified:
  cygnal/cygnal.cpp
=== modified file 'cygnal/cygnal.cpp'
--- a/cygnal/cygnal.cpp 2008-11-12 17:14:14 +0000
+++ b/cygnal/cygnal.cpp 2008-11-15 03:36:20 +0000
@@ -65,6 +65,7 @@
 // classes internal to Cygnal
 #include "buffer.h"
 #include "handler.h"
+#include "cache.h"
 
 #ifdef ENABLE_NLS
 #include <locale.h>
@@ -93,8 +94,6 @@
 void dispatch_handler(Handler::thread_params_t *args);
 void admin_handler(Handler::thread_params_t *args);
 
-LogFile& dbglogfile = LogFile::getDefaultInstance();
-
 // Toggles very verbose debugging info from the network Network class
 static bool netdebug = false;
 
@@ -124,8 +123,12 @@
 
 // end of globals
 
+static LogFile& dbglogfile = LogFile::getDefaultInstance();
+
 // The rcfile is loaded and parsed here:
-CRcInitFile& crcfile = CRcInitFile::getDefaultInstance();
+static CRcInitFile& crcfile = CRcInitFile::getDefaultInstance();
+
+static Cache& cache = Cache::getDefaultInstance();
 
 // This mutex is used to signify when all the threads are done.
 static boost::condition        alldone;
@@ -339,7 +342,7 @@
 admin_handler(Handler::thread_params_t *args)
 {
     GNASH_REPORT_FUNCTION;
-    int retries = 10;
+    int retries = 100;
     int ret;
 
     map<int, Handler *>::iterator hit;
@@ -357,15 +360,13 @@
            Network::byte_t data[ADMINPKTSIZE+1];
            memset(data, 0, ADMINPKTSIZE+1);
            const char *ptr = reinterpret_cast<const char *>(data);
-           ret = net.readNet(data, ADMINPKTSIZE, 3);
+           ret = net.readNet(data, ADMINPKTSIZE, 100);
            // force the case to make comparisons easier. Only compare enough 
characters to
            // till each command is unique.
            std::transform(ptr, ptr + ret, data, (int(*)(int)) toupper);
-           if (ret == 0) {
+           if (ret < 0) {
                net.writeNet("no more admin data, exiting...\n");
                if ((ret == 0) && cmd != Handler::POLL) {
-//                 retries = 0;
-                   ret = -1;
                    break;
                }
            } else {
@@ -388,6 +389,11 @@
                  ret = -1;
                  break;
              case Handler::STATUS:
+             {
+#ifdef USE_STATS_CACHE
+//               cache.dump();
+                 cache.stats();
+#endif
 #if 0
                  response << handlers.size() << " handlers are currently 
active.";
                  for (hit = handlers.begin(); hit != handlers.end(); hit++) {
@@ -401,8 +407,9 @@
                      index++;
                  }
 #endif
-                 index = 0;
-                 break;
+             }
+             index = 0;
+             break;
              case Handler::POLL:
 #ifdef USE_STATS_QUEUE
                  index = 0;
@@ -438,7 +445,7 @@
              default:
                  break;
            };
-       } while (ret >= 0);
+       } while (ret > 0);
        net.writeNet("admin_handler: Done...!\n");
        net.closeNet();         // this shuts down this socket connection
     }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]