[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/cygnal ChangeLog buffer.cpp buffer.h cque...
From: |
Rob Savoye |
Subject: |
[Gnash-commit] gnash/cygnal ChangeLog buffer.cpp buffer.h cque... |
Date: |
Tue, 18 Mar 2008 22:04:29 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Rob Savoye <rsavoye> 08/03/18 22:04:28
Modified files:
cygnal : ChangeLog buffer.cpp buffer.h cque.cpp cque.h
cygnal.cpp handler.cpp http.cpp
Log message:
* buffer.{h,cpp}: Add a few ::copy methods to put data into a
buffer easily.
* cque.{h,cpp}: Add an optional name to make debugging messages
clearer.
* handler.cpp: Add names to the ques. Cleanup typo that blocked
on
the wrong mutex.
* http.cpp: Fix the output messages.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ChangeLog?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/buffer.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/buffer.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/cque.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/cque.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/cygnal.cpp?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/handler.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/http.cpp?cvsroot=gnash&r1=1.19&r2=1.20
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/cygnal/ChangeLog,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- ChangeLog 18 Mar 2008 19:54:56 -0000 1.8
+++ ChangeLog 18 Mar 2008 22:04:28 -0000 1.9
@@ -1,5 +1,13 @@
2008-03-18 Rob Savoye <address@hidden>
+ * buffer.{h,cpp}: Add a few ::copy methods to put data into a
+ buffer easily.
+ * cque.{h,cpp}: Add an optional name to make debugging messages
+ clearer.
+ * handler.cpp: Add names to the ques. Cleanup typo that blocked on
+ the wrong mutex.
+ * http.cpp: Fix the output messages.
+
* http.cpp: Use Network::byte_t instead of boost_uint8_t. Use a
Buffer too.
Index: buffer.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/buffer.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- buffer.cpp 18 Mar 2008 01:06:03 -0000 1.2
+++ buffer.cpp 18 Mar 2008 22:04:28 -0000 1.3
@@ -72,12 +72,19 @@
// Put data into the buffer
void
-Buffer::copy(Network::byte_t *data, int nbytes)
+Buffer::copy(Network::byte_t *data, size_t nbytes)
{
// GNASH_REPORT_FUNCTION;
std::copy(data, data + nbytes, _ptr);
}
+void
+Buffer::copy(string &str)
+{
+// GNASH_REPORT_FUNCTION;
+ std::copy(str.begin(), str.end(), _ptr);
+}
+
// make ourselves be able to be copied.
Buffer &
Buffer::operator=(Buffer *buf)
Index: buffer.h
===================================================================
RCS file: /sources/gnash/gnash/cygnal/buffer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- buffer.h 18 Mar 2008 01:06:03 -0000 1.2
+++ buffer.h 18 Mar 2008 22:04:28 -0000 1.3
@@ -42,7 +42,9 @@
void *resize(size_t nbytes);
// Put data into the buffer
- void copy(gnash::Network::byte_t *data, int nbytes);
+ void copy(gnash::Network::byte_t *data, size_t nbytes);
+ void copy(gnash::Network::byte_t *data) { copy(data, _nbytes); };
+ void copy(std::string &str);
// Accessors
gnash::Network::byte_t *reference() { return _ptr; }
Index: cque.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/cque.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- cque.cpp 18 Mar 2008 01:06:03 -0000 1.2
+++ cque.cpp 18 Mar 2008 22:04:28 -0000 1.3
@@ -38,6 +38,7 @@
CQue::CQue()
{
// GNASH_REPORT_FUNCTION;
+ _name = "default";
}
CQue::~CQue()
@@ -61,7 +62,7 @@
GNASH_REPORT_FUNCTION;
boost::mutex::scoped_lock lk(_cond_mutex);
_cond.wait(lk);
- log_debug("wait mutex released");
+ log_debug("wait mutex released for \"%s\"", _name);
}
// Notify a condition variable to trigger
@@ -70,7 +71,7 @@
{
GNASH_REPORT_FUNCTION;
_cond.notify_one();
- log_debug("wait mutex triggered");
+ log_debug("wait mutex triggered for \"%s\"", _name);
}
size_t
@@ -221,7 +222,7 @@
// GNASH_REPORT_FUNCTION;
deque<Buffer *>::iterator it;
boost::mutex::scoped_lock lock(_mutex);
- cerr << endl << "CQue has "<< _que.size() << " buffers." << endl;
+ cerr << endl << "CQue \"" << _name << "\" has "<< _que.size() << "
buffers." << endl;
for (it = _que.begin(); it != _que.end(); it++) {
Buffer *ptr = *(it);
ptr->dump();
Index: cque.h
===================================================================
RCS file: /sources/gnash/gnash/cygnal/cque.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- cque.h 18 Mar 2008 01:06:04 -0000 1.2
+++ cque.h 18 Mar 2008 22:04:28 -0000 1.3
@@ -34,6 +34,7 @@
class CQue {
public:
CQue();
+ CQue(const std::string &str) { _name = str; };
~CQue();
// Push data onto the que
bool push(gnash::Network::byte_t *data, int nbytes);
@@ -60,7 +61,10 @@
Buffer *merge(Buffer *begin);
// Dump the data to the terminal
void dump();
+ void setName(const std::string &str) { _name = str; }
private:
+ // an optional name for the queue, only used for debugging messages to
make them unique
+ std::string _name;
// The queue itself
std::deque<Buffer *> _que;
// A condition variable used to signal the other thread when the que has
data
Index: cygnal.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/cygnal.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- cygnal.cpp 18 Mar 2008 01:06:04 -0000 1.24
+++ cygnal.cpp 18 Mar 2008 22:04:28 -0000 1.25
@@ -181,7 +181,7 @@
}
}
- dbglogfile.setLogFilename("cygnal-dbg.log");
+// dbglogfile.setLogFilename("cygnal-dbg.log");
// get the file name from the command line
while (optind < argc) {
Index: handler.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/handler.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- handler.cpp 18 Mar 2008 01:06:04 -0000 1.3
+++ handler.cpp 18 Mar 2008 22:04:28 -0000 1.4
@@ -151,6 +151,8 @@
// GNASH_REPORT_FUNCTION;
int retries = 10;
+ _incoming.setName("Incoming");
+ _outgoing.setName("Outgoing");
toggleDebug(true); // FIXME:
createServer(args->port);
while (retries-- > 0) {
@@ -162,8 +164,10 @@
log_debug("Starting thread 1");
boost::thread inport(boost::bind(&netin_handler, args));
+#if 1
log_debug("Starting thread 2");
boost::thread outport(boost::bind(&netout_handler, args));
+#endif
log_debug("Starting thread 3");
boost::thread handler(boost::bind(&httphandler, args));
@@ -204,9 +208,11 @@
// cerr << str << endl;
hand->notify();
} else {
+ cerr << __PRETTY_FUNCTION__ << "exiting, no data" << endl;
break;
}
}
+ hand->notify();
// hand->dump();
}
void
@@ -218,8 +224,9 @@
do {
Handler *hand = reinterpret_cast<Handler *>(args->handle);
- hand->wait();
+ hand->waitout();
Buffer *buf = hand->popout();
+ buf->dump();
ret = hand->writeNet(buf);
} while (ret > 0);
Index: http.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/http.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- http.cpp 18 Mar 2008 19:54:56 -0000 1.19
+++ http.cpp 18 Mar 2008 22:04:28 -0000 1.20
@@ -130,7 +130,7 @@
extractConnection(buf);
extractEncoding(buf);
extractTE(buf);
- dump();
+// dump();
// // See if we got a legit GET request
// if (strncmp(ptr, "GET ", 4) == 0) {
@@ -373,25 +373,23 @@
formatHeader(_filesize, HTML);
// int ret = Network::writeNet(_header.str());
Buffer *buf = new Buffer;
- Network::byte_t *ptr = (Network::byte_t *)_body.str().c_str();
- buf->copy(ptr, _body.str().size());
- buf->resize(_body.str().size());
+// Network::byte_t *ptr = (Network::byte_t *)_body.str().c_str();
+// buf->copy(ptr, _body.str().size());
+ _handler->dump();
+ if (_header.str().size()) {
+ buf->resize(_header.str().size());
+ string str = _header.str();
+ buf->copy(str);
_handler->pushout(buf);
_handler->notifyout();
-// if ( _body.str().size() > 0) {
-// ret += Network::writeNet(_body.str());
-// }
-
-// if (ret >= 0) {
log_debug (_("Sent GET Reply"));
-// log_debug (_("Sent GET Reply: %s"), _header.str().c_str());
- clearHeader();
-// } else {
-// log_debug (_("Couldn't send GET Reply, writeNet returned %d"), ret);
-// return false;
-// }
-// cout << "GET Header is:" << endl << _header.str() << endl;
return true; // Default to true
+ } else {
+ clearHeader();
+ log_debug (_("Couldn't send GET Reply, no header data"));
+ }
+
+ return false;
}
bool
@@ -893,7 +891,7 @@
HTTP www;
www.setHandler(hand);
-// hand->_outcond.wait();
+ hand->wait();
// www.toggleDebug(true);
@@ -929,8 +927,8 @@
// conndata->statistics->addStats();
if (url != docroot) {
- log_debug (_("File to load is: %s"), filespec.c_str());
- log_debug (_("Parameters are: %s"), parameters.c_str());
+// log_debug (_("File to load is: %s"), filespec.c_str());
+// log_debug (_("Parameters are: %s"), parameters.c_str());
// memset(args->filespec, 0, 256);
// memcpy(->filespec, filespec.c_str(), filespec.size());
// boost::thread sendthr(boost::bind(&stream_thread, args));
- [Gnash-commit] gnash/cygnal ChangeLog buffer.cpp buffer.h cque...,
Rob Savoye <=
- [Gnash-commit] gnash/cygnal ChangeLog buffer.cpp buffer.h cque..., Rob Savoye, 2008/03/25
- Message not available
- Re: [Gnash-commit] gnash/cygnal ChangeLog buffer.cpp buffer.h cque..., Rob Savoye, 2008/03/26
- Re: [Gnash-commit] gnash/cygnal ChangeLog buffer.cpp buffer.h cque..., Dossy Shiobara, 2008/03/26
- Re: [Gnash-commit] gnash/cygnal ChangeLog buffer.cpp buffer.h cque..., strk, 2008/03/26
- Re: [Gnash-commit] gnash/cygnal ChangeLog buffer.cpp buffer.h cque..., Dossy Shiobara, 2008/03/26
- Re: [Gnash-commit] gnash/cygnal ChangeLog buffer.cpp buffer.h cque..., Rob Savoye, 2008/03/26