tosinbot / rtmplite

Automatically exported from code.google.com/p/rtmplite
0 stars 0 forks source link

Changing Message to Message(object) breaks #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Reported by Valery <sentromed@mail.ru> on Nov 30, 2009.

> Hi,
>
> Most probably there is a bug in your code.
> If I change Message to class Message(object), playing stop working. Second
> connection hangs and response is not sent back to flash.
>
> The issue somewhere in property, fget, fset. Without 'object', message.type
> does not set message.header.type and everything works.
>
> So this is strange for me.
>
> It will be great if you explain that and provide a fix.
>
> Thanks,
> Valery.
>

Original issue reported on code.google.com by voiprese...@gmail.com on 3 Feb 2011 at 7:13

GoogleCodeExporter commented 8 years ago
Fixed on Dec 1, 2009.

Hi Valery,

I found the problem and sent the fixes in rtmp.py.

The bug was in this line:

 def __init__(self, hdr=Header(), data=''):

Changed this to:

def __init__(self, hdr=None, data=''):
       if hdr is None: hdr = Header()

The reason being: Python uses the default argument of non-primitive
types as persistent object. So multiple calls to this function was
re-using the same Header object, causing problems when header item was
changed...

After this change, I also changed all the classes (except the
exception class) to use new style class definition derived from
object.

Original comment by voiprese...@gmail.com on 3 Feb 2011 at 7:15