[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/rtmp r9745: fix single threaded option to
From: |
rob |
Subject: |
[Gnash-commit] /srv/bzr/gnash/rtmp r9745: fix single threaded option to use no threads at all anymore. |
Date: |
Tue, 18 Nov 2008 09:11:33 -0700 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9745
committer: address@hidden
branch nick: rtmp
timestamp: Tue 2008-11-18 09:11:33 -0700
message:
fix single threaded option to use no threads at all anymore.
modified:
cygnal/cygnal.cpp
=== modified file 'cygnal/cygnal.cpp'
--- a/cygnal/cygnal.cpp 2008-11-15 03:36:20 +0000
+++ b/cygnal/cygnal.cpp 2008-11-18 16:11:33 +0000
@@ -45,6 +45,8 @@
#endif
}
+#include <boost/shared_ptr.hpp>
+
// classes internal to Gnash
#include "network.h"
#include "log.h"
@@ -106,7 +108,7 @@
// same read-only value.
// This is the default path to look in for files to be streamed.
-const char *docroot;
+const char *docroot = 0;
// This is the number of times a thread loop continues, for debugging only
int thread_retries = 10;
@@ -147,6 +149,7 @@
<< _(" -n, --netdebug Turn on net debugging messages") << endl
<< _(" -t, --testing Turn on special Gnash testing support") <<
endl
<< _(" -a, --admin Enable the administration thread") << endl
+ << _(" -r, --root Document root for all files") << endl
<< endl;
}
@@ -169,7 +172,8 @@
{ 'd', "dump", Arg_parser::no },
{ 'n', "netdebug", Arg_parser::no },
{ 't', "testing", Arg_parser::no },
- { 'a', "admin", Arg_parser::no }
+ { 'a', "admin", Arg_parser::no },
+ { 'r', "root", Arg_parser::yes }
};
Arg_parser parser(argc, argv, opts);
@@ -178,7 +182,7 @@
cout << parser.error() << endl;
exit(EXIT_FAILURE);
}
-
+
// crcfile.loadFiles();
// Set the log file name before trying to write to
@@ -196,7 +200,9 @@
} else {
docroot = "/var/www/html/software/tests/";
}
-
+ if (crcfile.getPortOffset()) {
+ port_offset = crcfile.getPortOffset();
+ }
// Handle command line arguments
for( int i = 0; i < parser.arguments(); ++i ) {
@@ -223,6 +229,9 @@
port_offset = parser.argument<int>(i);
crcfile.setPortOffset(port_offset);
break;
+ case 'r':
+ docroot = parser.argument(i).c_str();
+ break;
case 'n':
netdebug = true;
break;
@@ -245,6 +254,13 @@
// struct thread_params ssl_data;
// rtmp_data.port = port_offset + 1935;
// boost::thread rtmp_port(boost::bind(&rtmp_thread, &rtmp_data));
+ // Admin handler
+ if (admin) {
+ Handler::thread_params_t admin_data;
+ admin_data.port = gnash::ADMIN_PORT;
+ boost::thread admin_thread(boost::bind(&admin_handler, &admin_data));
+// admin_thread.join();
+ }
// Incomming connection handler for port 80, HTTP and
// RTMPT. As port 80 requires root access, cygnal supports a
@@ -256,34 +272,36 @@
http_data.port = port_offset + gnash::RTMPT_PORT;
http_data.netfd = 0;
http_data.filespec = docroot;
- boost::thread http_thread(boost::bind(&connection_handler, &http_data));
-
- // Incomming connection handler for port 1935, RTMP. As RTMP
- // is not a priviledged port, we just open it without an offset.
- Handler::thread_params_t rtmp_data;
- rtmp_data.port = gnash::RTMP_PORT;
- rtmp_data.netfd = 0;
- rtmp_data.filespec = docroot;
- boost::thread rtmp_thread(boost::bind(&connection_handler, &rtmp_data));
-
- // Admin handler
- if (admin) {
- Handler::thread_params_t admin_data;
- admin_data.port = gnash::ADMIN_PORT;
- boost::thread admin_thread(boost::bind(&admin_handler, &admin_data));
- admin_thread.join();
- }
-
+ if (crcfile.getThreadingFlag()) {
+ boost::thread http_thread(boost::bind(&connection_handler, &http_data));
+ } else {
+ connection_handler(&http_data);
+ }
+
+#if 0
+ // Incomming connection handler for port 1935, RTMP. As RTMP
+ // is not a priviledged port, we just open it without an offset.
+ Handler::thread_params_t rtmp_data;
+ rtmp_data.port = gnash::RTMP_PORT;
+ rtmp_data.netfd = 0;
+ rtmp_data.filespec = docroot;
+ if (crcfile.getThreadingFlag()) {
+ boost::thread rtmp_thread(boost::bind(&connection_handler,
&rtmp_data));
+ } else {
+ connection_handler(&rtmp_data);
+ }
+#endif
+
// wait for the thread to finish
// http_thread.join();
// rtmp_thread.join();
- // Wait for all the threads to die
- alldone.wait(lk);
-
- log_debug (_("Cygnal done..."));
-
- return(0);
+ // Wait for all the threads to die
+ alldone.wait(lk);
+
+ log_debug (_("Cygnal done..."));
+
+ return(0);
}
#if 0
@@ -523,9 +541,9 @@
if (args->port == (port_offset + RTMPT_PORT)) {
hand->addPollFD(fds, http_handler);
}
- if (args->port == RTMP_PORT) {
- hand->addPollFD(fds, rtmp_handler);
- }
+// if (args->port == RTMP_PORT) {
+// hand->addPollFD(fds, rtmp_handler);
+// }
// if supporting multiple threads
if (crcfile.getThreadingFlag()) {
hand = new Handler;
@@ -542,7 +560,8 @@
} else { // single threaded
log_debug("Single threaded mode for fd #%d", args->netfd);
args->handler = hand;
- dispatch_handler(args);
+// dispatch_handler(args);
+ http_handler(args);
}
//
log_debug("Restarting loop for next connection for port %d...",
args->port);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/rtmp r9745: fix single threaded option to use no threads at all anymore.,
rob <=