[Twisted-Python] RemoteReference decref
Hi, I'm still working on an Actionscript pb client, and have run into a bit of a conundrum with RemoteReference which is using python's built-in __del__ to trigger a decref. Actionscript doesn't have destructors so I will need to trigger the decref manually. based on my capture of a clent/server converation I am thinking that the client could do this in proto_answer s -: ('version', 6) r -: ['version', 6] r -: ['message', 1, 'root', 'login', 1, ['tuple', 'alice'], ['dictionary']] s -: ('answer', 1, ['tuple', 'x\x9b\x95\x1c\tJp\xe0\x96]\xf4\xdb\xeb\x13\t9', ('remote', 1)]) r -: ['message', 2, 1, 'respond', 1, ['tuple', '\x06\x04\xf1vI\xfeP\xa0\xdfzl(\xd9\x7f!t', ['remote', 1]], ['dictionary']] s -: ('answer', 2, ('remote', 2)) r -: ['decref', 1] r -: ['message', 3, 2, 'joinGroup', 1, ['tuple', '#lookingForFourth'], ['dictionary']] s -: ('answer', 3, ('remote', 3)) r -: ['decref', 2] r -: ['message', 4, 3, 'send', 1, ['tuple', 'You can call me Al.'], ['dictionary']] s -: ('message', 1, 1, 'print', 1, ['tuple', '<alice> says: You can call me Al.'], ['dictionary']) s -: ('answer', 4, ['None']) r -: ['decref', 3] Not sure where I get a reference to RemoteReference though. any ideas ?
On Thu, 28 Aug 2008 13:19:50 +0100, A <aldoogy@gmail.com> wrote:
Hi, I'm still working on an Actionscript pb client,
and have run into a bit of a conundrum with RemoteReference which is using python's built-in __del__ to trigger a decref. Actionscript doesn't have destructors so I will need to trigger the decref manually.
based on my capture of a clent/server converation I am thinking that the client could do this in proto_answer
This doesn't sound like it makes sense. You should only decref when the object is no longer in use. If you can't do it from a destructor, then you have to require application code to do it. The protocol implementation can't know when the application has finished using the object.
s -: ('version', 6) r -: ['version', 6] r -: ['message', 1, 'root', 'login', 1, ['tuple', 'alice'], ['dictionary']] s -: ('answer', 1, ['tuple', 'x\x9b\x95\x1c\tJp\xe0\x96]\xf4\xdb\xeb\x13\t9', ('remote', 1)]) r -: ['message', 2, 1, 'respond', 1, ['tuple', '\x06\x04\xf1vI\xfeP\xa0\xdfzl(\xd9\x7f!t', ['remote', 1]], ['dictionary']] s -: ('answer', 2, ('remote', 2)) r -: ['decref', 1] r -: ['message', 3, 2, 'joinGroup', 1, ['tuple', '#lookingForFourth'], ['dictionary']] s -: ('answer', 3, ('remote', 3)) r -: ['decref', 2] r -: ['message', 4, 3, 'send', 1, ['tuple', 'You can call me Al.'], ['dictionary']] s -: ('message', 1, 1, 'print', 1, ['tuple', '<alice> says: You can call me Al.'], ['dictionary']) s -: ('answer', 4, ['None']) r -: ['decref', 3]
The protocol capture shows decrefs after answers purely by coincidence. If the application code being run to generate this kept references to the objects longer, then you wouldn't see this pattern. Jean-Paul
Thanks I didn't quite understand what decref was for. I thought it might be the cause of another problem I was having. but it's not a major problem - decref will just have to be triggered manually in an AS client. I have a tendency to just jump in at the deep end and hope I can figure things out .. . so I really appreciate the help. Jean-Paul Calderone wrote:
On Thu, 28 Aug 2008 13:19:50 +0100, A <aldoogy@gmail.com> wrote:
Hi, I'm still working on an Actionscript pb client,
and have run into a bit of a conundrum with RemoteReference which is using python's built-in __del__ to trigger a decref. Actionscript doesn't have destructors so I will need to trigger the decref manually.
based on my capture of a clent/server converation I am thinking that the client could do this in proto_answer
This doesn't sound like it makes sense. You should only decref when the object is no longer in use. If you can't do it from a destructor, then you have to require application code to do it. The protocol implementation can't know when the application has finished using the object.
s -: ('version', 6) r -: ['version', 6] r -: ['message', 1, 'root', 'login', 1, ['tuple', 'alice'], ['dictionary']] s -: ('answer', 1, ['tuple', 'x\x9b\x95\x1c\tJp\xe0\x96]\xf4\xdb\xeb\x13\t9', ('remote', 1)]) r -: ['message', 2, 1, 'respond', 1, ['tuple', '\x06\x04\xf1vI\xfeP\xa0\xdfzl(\xd9\x7f!t', ['remote', 1]], ['dictionary']] s -: ('answer', 2, ('remote', 2)) r -: ['decref', 1] r -: ['message', 3, 2, 'joinGroup', 1, ['tuple', '#lookingForFourth'], ['dictionary']] s -: ('answer', 3, ('remote', 3)) r -: ['decref', 2] r -: ['message', 4, 3, 'send', 1, ['tuple', 'You can call me Al.'], ['dictionary']] s -: ('message', 1, 1, 'print', 1, ['tuple', '<alice> says: You can call me Al.'], ['dictionary']) s -: ('answer', 4, ['None']) r -: ['decref', 3]
The protocol capture shows decrefs after answers purely by coincidence. If the application code being run to generate this kept references to the objects longer, then you wouldn't see this pattern.
Jean-Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (2)
-
A
-
Jean-Paul Calderone