[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libamf/amf.cpp libamf/element.c...
From: |
Rob Savoye |
Subject: |
[Gnash-commit] gnash ChangeLog libamf/amf.cpp libamf/element.c... |
Date: |
Tue, 17 Jun 2008 14:55:14 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Rob Savoye <rsavoye> 08/06/17 14:55:14
Modified files:
. : ChangeLog
libamf : amf.cpp element.cpp element.h
libnet : network.cpp network.h rtmp.cpp rtmp.h
rtmp_client.cpp rtmp_client.h rtmp_msg.h
Log message:
* libamf/amf.cpp: Drop a few debug messages.
* libamf/element.{h,cpp}: Add a findProperty() method. Use a
NULL
terminated string for printing.
* libnet/network.{h,cpp}: Read data into a Buffer. Add a readNet
with a timeout value.
* libnet/rtmp.{h,cpp}: Add array's for printing of enum types
for
debugging purposes. Delete all allocated pointers. Add method
for
sending messages, this does a complete send/receive process.
* libnet/rtmp_client.cpp: Make client side RTMP handshake
negotiation work again.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6961&r2=1.6962
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/amf.cpp?cvsroot=gnash&r1=1.81&r2=1.82
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/element.cpp?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/element.h?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/libnet/network.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libnet/network.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/libnet/rtmp.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/libnet/rtmp.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/libnet/rtmp_client.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libnet/rtmp_client.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libnet/rtmp_msg.h?cvsroot=gnash&r1=1.1&r2=1.2
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6961
retrieving revision 1.6962
diff -u -b -r1.6961 -r1.6962
--- ChangeLog 17 Jun 2008 14:04:17 -0000 1.6961
+++ ChangeLog 17 Jun 2008 14:55:12 -0000 1.6962
@@ -1,3 +1,16 @@
+2008-06-17 Rob Savoye <address@hidden>
+
+ * libamf/amf.cpp: Drop a few debug messages.
+ * libamf/element.{h,cpp}: Add a findProperty() method. Use a NULL
+ terminated string for printing.
+ * libnet/network.{h,cpp}: Read data into a Buffer. Add a readNet
+ with a timeout value.
+ * libnet/rtmp.{h,cpp}: Add array's for printing of enum types for
+ debugging purposes. Delete all allocated pointers. Add method for
+ sending messages, this does a complete send/receive process.
+ * libnet/rtmp_client.cpp: Make client side RTMP handshake
+ negotiation work again.
+
2008-06-17 Sandro Santilli <address@hidden>
* testsuite/misc-ming.all/NetStream-SquareTest.c: add tests for
Index: libamf/amf.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/amf.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- libamf/amf.cpp 6 Jun 2008 14:21:31 -0000 1.81
+++ libamf/amf.cpp 17 Jun 2008 14:55:13 -0000 1.82
@@ -675,7 +675,7 @@
Element *
AMF::extractAMF(Network::byte_t *in, Network::byte_t* tooFar)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
Element *el = new Element;
Network::byte_t *tmpptr = in;
@@ -790,7 +790,7 @@
Element *
AMF::extractProperty(Network::byte_t *in, Network::byte_t* tooFar)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
Network::byte_t *tmpptr = in;
boost::uint16_t length;
@@ -815,7 +815,7 @@
}
// name is just debugging help to print cleaner, and should be removed
later
- log_debug(_("AMF property name length is: %d"), length);
+// log_debug(_("AMF property name length is: %d"), length);
std::string name(reinterpret_cast<const char *>(tmpptr), length);
log_debug(_("AMF property name is: %s"), name);
Index: libamf/element.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/element.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- libamf/element.cpp 10 Jun 2008 01:03:21 -0000 1.28
+++ libamf/element.cpp 17 Jun 2008 14:55:13 -0000 1.29
@@ -396,7 +396,7 @@
Buffer *
Element::encode()
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
Buffer *buf = 0;
size_t size = 0;
if (_type == Element::OBJECT_AMF0) {
@@ -430,7 +430,7 @@
break;
}
}
- log_debug("FIXME: Terminating object");
+// log_debug("FIXME: Terminating object");
Network::byte_t pad = 0;
buf->append(pad);
buf->append(pad);
@@ -466,7 +466,7 @@
Element &
Element::operator=(Element *el)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
_type = el->getType();
if (el->getNameSize()) {
_name = strdup(el->getName());
@@ -946,7 +946,8 @@
case Element::STRING_AMF0:
cerr << "(" << getLength() << " bytes): ";
if (getLength() > 0) {
- cerr << "\t\"" << to_string() << "\"" << endl;
+ char *term = strndup(to_string(), getLength());
+ cerr << "\t\"" << term << "\"" << endl;
} else {
cerr << endl;
}
@@ -990,7 +991,7 @@
if (_properties.size() > 0) {
vector<amf::Element *>::iterator ait;
- cerr << "# of Properties in object" << _properties.size() << endl;
+ cerr << "# of Properties in object: " << _properties.size() << endl;
for (ait = _properties.begin(); ait != _properties.end(); ait++) {
amf::Element *el = (*(ait));
el->dump();
@@ -998,6 +999,23 @@
}
}
+Element *
+Element::findProperty(const std::string &name)
+{
+ if (_properties.size() > 0) {
+ vector<amf::Element *>::iterator ait;
+// cerr << "# of Properties in object: " << _properties.size() << endl;
+ for (ait = _properties.begin(); ait != _properties.end(); ait++) {
+ amf::Element *el = (*(ait));
+ if (el->getName() == name) {
+ return el;
+ }
+// el->dump();
+ }
+ }
+ return 0;
+}
+
} // end of amf namespace
// local Variables:
Index: libamf/element.h
===================================================================
RCS file: /sources/gnash/gnash/libamf/element.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- libamf/element.h 16 May 2008 03:46:22 -0000 1.22
+++ libamf/element.h 17 Jun 2008 14:55:13 -0000 1.23
@@ -195,6 +195,7 @@
void setName(const char *name, size_t x);
// Manipulate the children Elements of an object
+ Element *findProperty(const std::string &name);
Element *getProperty(size_t x) { return _properties[x]; };
void addProperty(Element &el) { _properties.push_back(&el); };
Index: libnet/network.cpp
===================================================================
RCS file: /sources/gnash/gnash/libnet/network.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libnet/network.cpp 14 Jun 2008 22:23:54 -0000 1.3
+++ libnet/network.cpp 17 Jun 2008 14:55:13 -0000 1.4
@@ -682,14 +682,37 @@
return false;
}
+amf::Buffer *
+Network::readNet()
+{
+ GNASH_REPORT_FUNCTION;
+
+ amf::Buffer *buffer = new amf::Buffer;
+ int nbytes = readNet(buffer);
+ if (nbytes > 0) {
+ buffer->resize(nbytes);
+ return buffer;
+ }
+
+ return 0;
+}
+
// Read from the connection
int
Network::readNet(amf::Buffer *buffer)
{
+ GNASH_REPORT_FUNCTION;
return readNet(_sockfd, buffer->reference(), buffer->size(), _timeout);
}
int
+Network::readNet(amf::Buffer *buffer, int timeout)
+{
+ GNASH_REPORT_FUNCTION;
+ return readNet(_sockfd, buffer->reference(), buffer->size(), timeout);
+}
+
+int
Network::readNet(byte_t *buffer, int nbytes)
{
return readNet(_sockfd, buffer, nbytes, _timeout);
Index: libnet/network.h
===================================================================
RCS file: /sources/gnash/gnash/libnet/network.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libnet/network.h 14 Jun 2008 22:23:54 -0000 1.6
+++ libnet/network.h 17 Jun 2008 14:55:13 -0000 1.7
@@ -95,7 +95,9 @@
bool createClient(const std::string &hostname, short port);
// Read from the connection
+ amf::Buffer *readNet();
int readNet(amf::Buffer *buffer);
+ int readNet(amf::Buffer *buffer, int timeout);
int readNet(byte_t *buffer, int nbytes);
int readNet(byte_t *buffer, int nbytes, int timeout);
int readNet(int fd, byte_t *buffer, int nbytes);
@@ -117,6 +119,7 @@
// Change the debug flag
void toggleDebug(bool val);
+ bool netDebug() { return _debug; };
bool send(const char *str);
Index: libnet/rtmp.cpp
===================================================================
RCS file: /sources/gnash/gnash/libnet/rtmp.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- libnet/rtmp.cpp 14 Jun 2008 17:18:30 -0000 1.12
+++ libnet/rtmp.cpp 17 Jun 2008 14:55:13 -0000 1.13
@@ -71,6 +71,66 @@
"Invoke"
};
+const char *ping_str[] = {
+ "PING_CLEAR",
+ "PING_PLAY",
+ "Unknown Ping 2",
+ "PING_TIME",
+ "PING_RESET",
+ "Unknown Ping 2",
+ "PING_CLIENT",
+ "PONG_CLIENT"
+};
+
+const char *status_str[] = {
+ "APP_GC",
+ "APP_RESOURCE_LOWMEMORY",
+ "APP_SCRIPT_ERROR",
+ "APP_SCRIPT_WARNING",
+ "APP_SHUTDOWN",
+ "NC_CALL_BADVERSION",
+ "NC_CALL_FAILED",
+ "NC_CONNECT_APPSHUTDOWN",
+ "NC_CONNECT_CLOSED",
+ "NC_CONNECT_FAILED",
+ "NC_CONNECT_INVALID_APPLICATION",
+ "NC_CONNECT_REJECTED",
+ "NC_CONNECT_SUCCESS",
+ "NS_CLEAR_FAILED",
+ "NS_CLEAR_SUCCESS",
+ "NS_DATA_START",
+ "NS_FAILED",
+ "NS_INVALID_ARGUMENT",
+ "NS_PAUSE_NOTIFY",
+ "NS_PLAY_COMPLETE",
+ "NS_PLAY_FAILED",
+ "NS_PLAY_FILE_STRUCTURE_INVALID",
+ "NS_PLAY_INSUFFICIENT_BW",
+ "NS_PLAY_NO_SUPPORTED_TRACK_FOUND",
+ "NS_PLAY_PUBLISHNOTIFY",
+ "NS_PLAY_RESET",
+ "NS_PLAY_START",
+ "NS_PLAY_STOP",
+ "NS_PLAY_STREAMNOTFOUND",
+ "NS_PLAY_SWITCH",
+ "NS_PLAY_UNPUBLISHNOTIFY",
+ "NS_PUBLISH_BADNAME",
+ "NS_PUBLISH_START",
+ "NS_RECORD_FAILED",
+ "NS_RECORD_NOACCESS",
+ "NS_RECORD_START",
+ "NS_RECORD_STOP",
+ "NS_SEEK_FAILED",
+ "NS_SEEK_NOTIFY",
+ "NS_UNPAUSE_NOTIFY",
+ "NS_UNPUBLISHED_SUCCESS",
+ "SO_CREATION_FAILED",
+ "SO_NO_READ_ACCESS",
+ "SO_NO_WRITE_ACCESS",
+ "SO_PERSISTENCE_MISMATCH"
+};
+
+
// These are the textual responses
const char *response_str[] = {
"/onStatus",
@@ -96,7 +156,7 @@
headersize = 4;
break;
case HEADER_1:
- headersize = 11;
+ headersize = 1;
break;
default:
log_error(_("AMF Header size bits (0x%X) out of range"),
@@ -123,6 +183,12 @@
{
// GNASH_REPORT_FUNCTION;
_variables.clear();
+ if (_handshake) {
+ delete _handshake;
+ }
+ if (_handler) {
+ delete _handler;
+ }
// delete _body;
}
@@ -195,6 +261,7 @@
if (_header.head_size >= 8) {
_header.type = *(content_types_e *)tmpptr;
+ _header.bodysize = sizeof(boost::uint16_t) * 2;
tmpptr++;
log_debug(_("The type is: %s"), content_str[_header.type]);
}
@@ -239,7 +306,7 @@
amf::Buffer *
RTMP::encodeHeader(int amf_index, rtmp_headersize_e head_size)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
amf::Buffer *buf = new Buffer(1);
Network::byte_t *ptr = buf->reference();
@@ -258,7 +325,7 @@
{
GNASH_REPORT_FUNCTION;
- amf::Buffer *buf = NULL;
+ amf::Buffer *buf = 0;
switch(head_size) {
case HEADER_1:
buf = new Buffer(1);
@@ -275,11 +342,12 @@
}
// FIXME: this is only to make this more readeable with GDB, and is a
performance hit.
-// buf->clear();
+ buf->clear();
Network::byte_t *ptr = buf->reference();
// Make the channel index & header size byte
- *ptr = head_size & RTMP_HEADSIZE_MASK;
+// *ptr = head_size & RTMP_HEADSIZE_MASK;
+ *ptr = head_size; // & RTMP_INDEX_MASK;
*ptr += amf_index & RTMP_INDEX_MASK;
ptr++;
@@ -558,15 +626,15 @@
while (ptr < tooFar) {
// These pointers get deleted automatically when the msg object is
deleted
amf::Element *el = amf_obj.extractAMF(ptr, tooFar);
+ ptr += amf_obj.totalsize();
if (el == 0) {
break;
}
-// el->dump();
+ el->dump();
msg->addObject(el);
if (status) {
msg->checkStatus(el);
}
- ptr += amf_obj.totalsize();
};
// cleanup after ourselves
@@ -717,6 +785,109 @@
log_unimpl(__PRETTY_FUNCTION__);
}
+// Send a message, usually a single ActionScript object. This message
+// may be broken down into a series of packets on a regular byte
+// interval. (128 bytes for video data). Each message main contain
+// multiple packets.
+bool
+RTMP::sendMsg(amf::Buffer *buf)
+{
+ GNASH_REPORT_FUNCTION;
+
+ size_t partial = RTMP_VIDEO_PACKET_SIZE;
+ size_t nbytes = 0;
+ Network::byte_t header = 0xc3;
+
+ while (nbytes <= buf->size()) {
+ if ((buf->size() - nbytes) < RTMP_VIDEO_PACKET_SIZE) {
+ partial = buf->size() - nbytes;
+ }
+ writeNet(buf->reference() + nbytes, partial);
+ if (partial == RTMP_VIDEO_PACKET_SIZE) {
+ writeNet(&header, 1);
+ }
+ nbytes += RTMP_VIDEO_PACKET_SIZE;
+ };
+}
+
+// Send a Msg, and expect a response back of some kind.
+amf::Element *
+RTMP::sendRecvMsg(int amf_index, rtmp_headersize_e head_size,
+ size_t total_size, content_types_e type,
+ RTMPMsg::rtmp_source_e routing, amf::Buffer *bufin)
+{
+ GNASH_REPORT_FUNCTION;
+// size_t total_size = buf2->size() - 6; // FIXME: why drop 6 bytes ?
+ Buffer *head = encodeHeader(amf_index, head_size, total_size,
+ type, routing);
+ int ret = writeNet(head);
+// if (netDebug()) {
+// cerr << __FUNCTION__ << ": " <<__LINE__ << ": " <<
hexify(head->reference(), headerSize(head_size), false) << endl;
+// }
+
+ ret = sendMsg(bufin);
+ if (netDebug()) {
+ cerr << __FUNCTION__ << ": " << __LINE__ << ": " <<
hexify(head->reference(), headerSize(head_size), false) <<
hexify(bufin->reference(), ret, true) << endl;
+ }
+
+ Buffer buf;
+ ret = readNet(&buf, 5);
+ if (ret < 0) {
+ log_error("Never got any data!");
+ return 0;
+ }
+ if ((ret == 1) && (*buf.reference() == 0xff)) {
+ log_error("Got an error from the server sending object of type %s",
+ content_str[type]);
+ ret = readNet(&buf, 5);
+ if (ret < 0) {
+ log_error("Never got any data!");
+ return 0;
+ }
+ if ((ret == 1) && (*buf.reference() == 0xff)) {
+ cerr << __FUNCTION__ << ": " << __LINE__ << ": " <<
+ hexify(buf.reference(), buf.size(), false) << endl;
+ log_error("Got an error from the server sending object of type %s",
+ content_str[type]);
+// exit(-1);
+ }
+ }
+
+ RTMP::rtmp_head_t *rthead = decodeHeader(&buf);
+
+ RTMPMsg *msg;
+ if (rthead) {
+ if (rthead->head_size == 1) {
+ log_debug("Response header: %s", hexify(buf.reference(),
+ 7, false));
+ } else {
+ log_debug("Response header: %s", hexify(buf.reference(),
+ rthead->head_size, false));
+ }
+ if (rthead->type == RTMP::PING) {
+ RTMP::rtmp_ping_t *ping = decodePing(buf.reference());
+ log_debug("FIXME: Ping type is: %d, ignored for now", ping->type);
+ } else if (rthead->type != RTMP::PING) {
+ msg = decodeMsgBody(buf.reference() + rthead->head_size,
rthead->bodysize);
+ if (msg) {
+ log_debug("%s: Msg status is: %d: %s", __FUNCTION__,
+ msg->getStatus(), status_str[msg->getStatus()]);
+ } else {
+ log_error("Couldn't decode message body for type %s!",
+ content_str[rthead->type]);
+ }
+ } else {
+ log_error("Couldn't decode message header for type %s!",
+ content_str[type]);
+ }
+ }
+
+
+// Element *el = new Element;
+// el.
+ return 0;
+}
+
} // end of gnash namespace
// local Variables:
Index: libnet/rtmp.h
===================================================================
RCS file: /sources/gnash/gnash/libnet/rtmp.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libnet/rtmp.h 6 Jun 2008 14:21:32 -0000 1.10
+++ libnet/rtmp.h 17 Jun 2008 14:55:13 -0000 1.11
@@ -32,7 +32,7 @@
namespace gnash
{
-const int RTMP_HANDSHAKE = 0x3;
+const Network::byte_t RTMP_HANDSHAKE = 0x3;
const int RTMP_BODY_SIZE = 1536;
const int MAX_AMF_INDEXES = 64;
@@ -71,7 +71,7 @@
onDebugEvents
} amfresponse_e;
-class DSOEXPORT RTMP
+class DSOEXPORT RTMP : public Network
{
public:
typedef enum {
@@ -264,6 +264,21 @@
virtual amf::Buffer *encodeInvoke();
virtual void decodeInvoke();
+ // Receive a message, which is a series of AMF elements, seperated
+ // by a one byte header at regular byte intervals. (128 bytes for
+ // video data). Each message main contain multiple packets.
+ amf::Buffer *recvMsg();
+
+ // Send a message, usually a single ActionScript object. This message
+ // may be broken down into a series of packets on a regular byte
+ // interval. (128 bytes for video data). Each message main contain
+ // multiple packets.
+ bool sendMsg(amf::Buffer *buf);
+
+ // Send a Msg, and expect a response back of some kind.
+ amf::Element *sendRecvMsg(int amf_index, rtmp_headersize_e head_size,
+ size_t total_size, content_types_e type,
+ RTMPMsg::rtmp_source_e routing, amf::Buffer *buf);
void dump();
protected:
std::map<const char *, amf::Element *> _variables;
Index: libnet/rtmp_client.cpp
===================================================================
RCS file: /sources/gnash/gnash/libnet/rtmp_client.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libnet/rtmp_client.cpp 10 Jun 2008 01:03:21 -0000 1.3
+++ libnet/rtmp_client.cpp 17 Jun 2008 14:55:13 -0000 1.4
@@ -75,7 +75,7 @@
double audioCodecs, double videoCodecs, double
videoFunction,
const char *pageUrl)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
AMF amf_obj;
@@ -171,7 +171,7 @@
amf::Buffer *
RTMPClient::encodeStream(double id)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
struct timespec now;
clock_gettime (CLOCK_REALTIME, &now);
@@ -238,7 +238,7 @@
amf::Buffer *
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, const
std::string &name, double pos)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
// Set the operations command name
Element str;
@@ -298,8 +298,8 @@
// Add 2 bytes for the Boolean, and 16 bytes for the two doubles, which are
// 8 bytes apiece.
pktsize += (sizeof(double) * 2) + 2;
-// Buffer *buf = new Buffer(pktsize);
- Buffer *buf = new Buffer;
+ Buffer *buf = new Buffer(pktsize);
+// Buffer *buf = new Buffer;
if (!buf) {
return 0;
@@ -345,30 +345,28 @@
{
GNASH_REPORT_FUNCTION;
-#if 0
- char buffer[RTMP_BODY_SIZE+1];
- char c = 0x3;
- int i, ret;
-
- ret = writeNet(&c, 1);
- _outbytes += 1;
- // something went wrong, chances are the other end of the network
- // connection is down, or never initialized.
- if (ret <= 0) {
+ // Make a buffer to hold the handshake data.
+ _handshake = new Buffer(RTMP_BODY_SIZE+1);
+ if (!_handshake) {
return false;
}
+ // All RTMP connections start with a 0x3
+ _handshake->copy(RTMP_HANDSHAKE);
+
// Since we don't know what the format is, create a pattern we can
// recognize if we stumble across it later on.
- for (i=0; i<RTMP_BODY_SIZE; i++) {
- buffer[i] = i^256;
+ for (int i=0; i<RTMP_BODY_SIZE; i++) {
+ Network::byte_t pad = i^256;
+ _handshake->append(pad);
}
- _outbytes += RTMP_BODY_SIZE;
- ret = writeNet(buffer, RTMP_BODY_SIZE);
-#endif
-
+ int ret = writeNet(_handshake);
+ if (ret) {
return true;
+ } else {
+ return false;
+ }
}
// The client finished the handshake process by sending the second
@@ -378,30 +376,43 @@
{
GNASH_REPORT_FUNCTION;
-#if 0
- char buffer[RTMP_BODY_SIZE+1];
- memset(buffer, 0, RTMP_BODY_SIZE+1);
+ int ret = 0;
+ _handshake->clear();
- if (readNet(buffer, RTMP_BODY_SIZE) == RTMP_BODY_SIZE) {
+ ret = readNet(_handshake->reference(), RTMP_BODY_SIZE);
+ if (ret == RTMP_BODY_SIZE) {
log_debug (_("Read first data block in handshake"));
} else {
log_error (_("Couldn't read first data block in handshake"));
- return false;
+// return false;
}
- _inbytes += RTMP_BODY_SIZE;
- if (readNet(buffer, RTMP_BODY_SIZE) == RTMP_BODY_SIZE) {
+ if (ret > RTMP_BODY_SIZE) {
+ ret = readNet(_handshake->reference(), RTMP_BODY_SIZE);
+ if (ret == RTMP_BODY_SIZE) {
log_debug (_("Read second data block in handshake"));
-// _body = new char(RTMP_BODY_SIZE+1);
-// memcpy(_body, buffer, RTMP_BODY_SIZE);
} else {
log_error (_("Couldn't read second data block in handshake"));
- return false;
+// return false;
+ }
+ }
+ ret = readNet(_handshake->reference(), RTMP_BODY_SIZE);
+ if (ret == RTMP_BODY_SIZE) {
+ log_debug (_("Read second data block in handshake"));
+ } else {
+ log_error (_("Couldn't read second data block in handshake"));
+// return false;
+ }
+ if (ret > RTMP_BODY_SIZE) {
+ ret = readNet(_handshake->reference(), RTMP_BODY_SIZE);
+ if (ret == RTMP_BODY_SIZE) {
+ log_debug (_("Read second data block in handshake"));
+ } else {
+ log_error (_("Couldn't read second data block in handshake"));
+// return false;
+ }
}
- _inbytes += RTMP_BODY_SIZE;
- writeNet(buffer, RTMP_BODY_SIZE);
- _outbytes += RTMP_BODY_SIZE;
-#endif
+ writeNet(_handshake->reference(), RTMP_BODY_SIZE);
return true;
}
Index: libnet/rtmp_client.h
===================================================================
RCS file: /sources/gnash/gnash/libnet/rtmp_client.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libnet/rtmp_client.h 6 Jun 2008 14:21:32 -0000 1.2
+++ libnet/rtmp_client.h 17 Jun 2008 14:55:14 -0000 1.3
@@ -40,7 +40,7 @@
~RTMPClient();
bool handShakeWait();
- bool handShakeResponse();
+// bool handShakeResponse();
bool clientFinish();
bool handShakeRequest();
Index: libnet/rtmp_msg.h
===================================================================
RCS file: /sources/gnash/gnash/libnet/rtmp_msg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libnet/rtmp_msg.h 16 May 2008 03:46:31 -0000 1.1
+++ libnet/rtmp_msg.h 17 Jun 2008 14:55:14 -0000 1.2
@@ -106,6 +106,7 @@
void setChannel(Network::byte_t num) { _channel = num; };
Network::byte_t getChannel() { return _channel; } ;
+
// Dump internal status to the terminal
void dump();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libamf/amf.cpp libamf/element.c...,
Rob Savoye <=