[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/rtmp r9683: start fixing to work with smar
From: |
rob |
Subject: |
[Gnash-commit] /srv/bzr/gnash/rtmp r9683: start fixing to work with smart pointers. |
Date: |
Sat, 01 Nov 2008 09:02:59 -0600 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9683
committer: address@hidden
branch nick: rtmp
timestamp: Sat 2008-11-01 09:02:59 -0600
message:
start fixing to work with smart pointers.
modified:
libnet/handler.cpp
libnet/handler.h
utilities/dumpshm.cpp
=== modified file 'libnet/handler.cpp'
--- a/libnet/handler.cpp 2008-09-22 18:25:27 +0000
+++ b/libnet/handler.cpp 2008-11-01 15:02:59 +0000
@@ -22,12 +22,14 @@
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
+#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
+#include <vector>
#include "log.h"
#include "network.h"
@@ -217,15 +219,17 @@
log_debug(_("Starting Handlers for port %d, tid %ld"),
args->port, get_thread_id());
- if (args->port == 4080) { // FIXME: hack alert!
- boost::thread handler(boost::bind(&httphandler, args));
+// boost::thread outport(boost::bind(&netout_handler, args));
+ boost::thread inport(boost::bind(&netin_handler, args));
+
+#if 0
+ if (args->port == 4080) { // FIXME: hack alert!
+ boost::thread handler(boost::bind(&http_handler, args));
}
if (args->port == RTMP_PORT) {
boost::thread handler(boost::bind(&rtmp_handler, args));
}
-
-// boost::thread outport(boost::bind(&netout_handler, args));
-// boost::thread inport(boost::bind(&netin_handler, args));
+#endif
// We don't want to wait for the threads to complete, we
// want to return to the main program so it can spawn another
@@ -239,20 +243,21 @@
return true;
}
-#if 0
extern "C" {
void
netin_handler(Handler::thread_params_t *args)
{
-// GNASH_REPORT_FUNCTION;
+ GNASH_REPORT_FUNCTION;
Handler *hand = reinterpret_cast<Handler *>(args->handle);
log_debug("Starting to wait for data in net for fd #%d", args->netfd);
do {
- boost::shared_ptr<amf::Buffer> buf = new amf::Buffer;
+ boost::shared_ptr<amf::Buffer> buf(new amf::Buffer);
size_t ret = hand->readNet(args->netfd, buf->reference(), buf->size(),
1);
+
+// cerr << (char *)buf->reference() << endl;
// the read timed out as there was no data, but the socket is still
open.
if (ret == 0) {
log_debug("no data yet for fd #%d, continuing...", args->netfd);
@@ -266,9 +271,10 @@
}
// We got data. Resize the buffer if necessary.
if (ret > 0) {
- if (ret < NETBUFSIZE) {
- buf->resize(ret);
- }
+// cerr << "XXXXX" << (char *)buf->reference() << endl;
+// if (ret < NETBUFSIZE) {
+// buf->resize(ret);
+// }
hand->push(buf);
hand->notify();
} else {
@@ -284,6 +290,7 @@
// hand->dump();
}
+#if 0
void
netout_handler(Handler::thread_params_t *args)
{
@@ -308,7 +315,6 @@
// log_debug("Got smaller packet, size %d", buf->size());
// }
ret = hand->writeNet(args->netfd, buf);
- delete buf;
}
} while (ret > 0);
hand->die();
@@ -325,9 +331,9 @@
delete hand;
#endif
}
+#endif
} // end of extern C
-#endif
} // end of gnash namespace
=== modified file 'libnet/handler.h'
--- a/libnet/handler.h 2008-09-22 18:25:27 +0000
+++ b/libnet/handler.h 2008-11-01 15:02:59 +0000
@@ -129,15 +129,27 @@
// start the two thread handlers for the queues
bool DSOEXPORT start(thread_params_t *args);
- // Take a buffer and write it to the network
- int DSOEXPORT writeNet(int fd, boost::shared_ptr<amf::Buffer> buf)
+ /// \brief Write a Buffer the network connection.
+ ///
+ /// @param fd The file descriptor to write the data too.
+ ///
+ /// @param buf A smart pointer to a Buffer class.
+ ///
+ /// @return The number of bytes sent
+ int DSOEXPORT writeNet(int fd, boost::shared_ptr<amf::Buffer> &buf)
{ return Network::writeNet(fd, buf->reference(), buf->size()); };
- int DSOEXPORT writeNet(boost::shared_ptr<amf::Buffer> buf)
+ /// \brief Write a Buffer the network connection.
+ ///
+ /// @param buf A smart pointer to a Buffer class.
+ ///
+ /// @return The number of bytes sent
+ int DSOEXPORT writeNet(boost::shared_ptr<amf::Buffer> &buf)
{ return Network::writeNet(buf->reference(), buf->size()); };
// Dump internal data.
void dump();
+
#ifdef USE_STATS_QUEUE
CQue::que_stats_t *statsin() { return _incoming.stats(); };
CQue::que_stats_t *statsout() { return _outgoing.stats(); };
=== modified file 'utilities/dumpshm.cpp'
--- a/utilities/dumpshm.cpp 2008-10-26 23:37:24 +0000
+++ b/utilities/dumpshm.cpp 2008-11-01 15:02:59 +0000
@@ -354,7 +354,6 @@
cerr << _("\tTotal # of bytes: ") << ptr->getSize() << endl;
}
-
// Local Variables:
// mode: C++
// indent-tabs-mode: t
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/rtmp r9683: start fixing to work with smart pointers.,
rob <=