gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/rtmp r10034: use recvChunked().


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r10034: use recvChunked().
Date: Tue, 24 Mar 2009 20:04:00 -0600
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10034
committer: address@hidden
branch nick: rtmp
timestamp: Tue 2009-03-24 20:04:00 -0600
message:
  use recvChunked().
modified:
  libcore/asobj/NetConnection_as.cpp
=== modified file 'libcore/asobj/NetConnection_as.cpp'
--- a/libcore/asobj/NetConnection_as.cpp        2009-03-24 17:45:01 +0000
+++ b/libcore/asobj/NetConnection_as.cpp        2009-03-25 02:04:00 +0000
@@ -489,6 +489,7 @@
 
 }
 
+
 /// Anonymous namespace for NetConnection interface implementation.
 
 namespace {
@@ -688,13 +689,13 @@
 
 //    boost::mutex::scoped_lock lock(call_mutex);
 
-//    args->caller->test();
-
+    args->network->setTimeout(50);
+    
     // Suck all the data waiting for us in the network
     boost::shared_ptr<amf::Buffer> buf(new amf::Buffer);
     do {
        size_t ret = args->network->readNet(buf->reference() + 
buf->allocated(), 
-                                        buf->size(), 10);
+                                        buf->size(), 60);
        // The timeout expired
        if (ret == 0) {
            log_debug("no data yet for fd #%d, continuing...",
@@ -733,7 +734,7 @@
            done = true;
        }
     } while(done != true);
-
+    
     // Now process the data
     if (result) {
        HTTP *http = reinterpret_cast<HTTP *>(args->network);;
@@ -746,16 +747,12 @@
        }
        // Make sure we have a sane length. If Chunked, then we don't have
        // a length field, so we use the size of the data that
+       boost::shared_ptr<amf::Buffer> chunk;
        if (length == 0) {
            if (chunked) {
-               length = buf->end() - data;
-               // A chunked transfer sends a count of messages in ASCII hex 
first,
-               // and that line is terminated with the usual \r\n HTTP header 
field
-               // line number
-               boost::uint8_t *start = std::find(data, data+length, '\r') + 2;
-               if (start != data+length) {
-                   data = start;
-               }
+               size_t count = http->recvChunked(data, (buf->end() - data));
+               log_debug("Got %d chunked data messages", count);
+               chunk = http->popChunk();
            } else {
                done = true;
                result = false;
@@ -767,7 +764,7 @@
        if (http->getField("content-type").find("application/x-amf") != 
string::npos) {
            amf::AMF_msg amsg;
            boost::shared_ptr<amf::AMF_msg::context_header_t> head =
-               amsg.parseAMFPacket(data, length);
+               amsg.parseAMFPacket(*chunk);
            amsg.dump();
            log_debug("%d messages in AMF packet", amsg.messageCount());
            for (size_t i=0; i<amsg.messageCount(); i++) {
@@ -793,7 +790,7 @@
                methodKey = args->st->find(methodName);
                args->callback->callMethod(methodKey, tmp);
            }
-       } else {// not AMF data
+       } else {        // not AMF data
            if ((http->getField("content-type").find("application/xml") != 
string::npos)
                || (http->getField("content-type").find("text/html") != 
string::npos)) {
                log_debug("Textual Data is: %s", reinterpret_cast<char 
*>(data));


reply via email to

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