[Twisted-Python] no factory.disconnect used the docs!?! (btw thx Itamar )

john nielsen jn at who.net
Fri Apr 23 11:50:58 MDT 2004


Once Itamar mentioned closing connections, then I realized I needed to add:

d.addCallback(lambda _: factory.disconnect())

The descriptors are now cleaned up.

An interesting point is that I cannot find any documentation that 
actually uses: factory.disconnect()

Did I miss it?

john
----- Original Message -----
From: twisted-python-request at twistedmatrix.com
Date: Thu, 22 Apr 2004 12:00:05 -0600
To: twisted-python at twistedmatrix.com
Subject: Twisted-Python Digest, Vol 1, Issue 1218

> Send Twisted-Python mailing list submissions to
> 	twisted-python at twistedmatrix.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> or, via email, send a message with subject or body 'help' to
> 	twisted-python-request at twistedmatrix.com
> 
> You can reach the person managing the list at
> 	twisted-python-owner at twistedmatrix.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Twisted-Python digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: Transporting pb.Copyable classes? (exarkun at divmod.com)
>    2. Re: Transporting pb.Copyable classes? (Jasper Phillips)
>    3. Unwinding the Twisted Web (a progress report) (David Reid)
>    4. Re: Unwinding the Twisted Web (a progress report)
>       (Itamar Shtull-Trauring)
>    5. how to have a server talk to a server (john nielsen)
>    6. Re: how to have a server talk to a server (Eric Mangold)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Wed, 21 Apr 2004 18:53:37 GMT
> From: <exarkun at divmod.com>
> Subject: Re: [Twisted-Python] Transporting pb.Copyable classes?
> To: "Twisted discussion stuff" <twisted-python at twistedmatrix.com>
> Message-ID: <20040421185337.9235.1895087205.divmod.quotient.13 at ohm>
> Content-Type: text/plain
> 
> On Wed, 21 Apr 2004 09:57:47 -0700 (PDT), Jasper Phillips <jasper at peak.org> wrote:
> >
> > [snip]
> > 
> > 
> > All this seems to me like frantic contortion to avoid a bug in jelly.
> > Shouldn't it be able to translate passed class objects into the remote
> > version, provided they have been properly registered?  Is there some reason
> > why not that I am missing?
> 
>   Indeed.  While I would do this differently, jelly should certainly be able to handle your approach.  Let's get into specifics, shall we?  Here's some code:
> 
> >>> from twisted.spread import jelly
> >>> class Foo: pass
> ... 
> >>> f = Foo()
> >>> f.bar = Foo
> >>> jelly.jelly(f)
> ['__main__.Foo', ['dictionary', ['bar', ['class', '__main__.Foo']]]]
> 
>   So far, so good.
> 
> >>> from twisted.spread import pb     
> >>> class Foo(pb.Copyable):
> ...     pass
> ... 
> >>> f = Foo()
> >>> f.bar = Foo
> >>> jelly.jelly(f)
> ['__main__.Foo', ['dictionary', ['bar', ['class', '__main__.Foo']]]]
> 
>   Hmm, that works too.  I expected it not to, actually.  I suppose something you're doing with globalSecurity or setCopierForClassTree() may be mucking things up.
> 
> > 
> > I appreciate the code suggestions, but basicaly I just want to know whether
> > this is expected behavior, or whether I should post a demonstrative test
> > case and suggest a fix.
> 
>   Posting a demonstrative test case would be excellent :)  I suspect there is no bug in jelly, just a disagreement in expectations which can easily be resolved once there is a concrete example to talk about.
> 
>   Jp
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Wed, 21 Apr 2004 14:03:47 -0700 (PDT)
> From: Jasper Phillips <jasper at peak.org>
> Subject: Re: [Twisted-Python] Transporting pb.Copyable classes?
> To: Twisted discussion stuff <twisted-python at twistedmatrix.com>
> Message-ID: <Pine.LNX.4.53.0404211301540.9678 at a.shell.peak.org>
> Content-Type: TEXT/PLAIN; charset=US-ASCII
> 
> 
> On Wed, 21 Apr 2004 exarkun at divmod.com wrote:
> 
> > On Wed, 21 Apr 2004 09:57:47 -0700 (PDT), Jasper Phillips <jasper at peak.org> wrote:
> > > 
> > > All this seems to me like frantic contortion to avoid a bug in jelly.
> > > Shouldn't it be able to translate passed class objects into the remote
> > > version, provided they have been properly registered?  Is there some reason
> > > why not that I am missing?
> > 
> >   Indeed.  While I would do this differently, jelly should certainly be
> >   able to handle your approach.  Let's get into specifics, shall we?
> >   Here's some code:
> 
> I may end up doing it differently, but one thing at a time!  I'm in the
> midst of upgrading to new cred, and already have plenty of scope with which
> to hang myself. ;-)
> 
> I'm not particularily attached to the static class approach, it just
> happened to be what came to mind when prototyping.  I'm definitely curious
> now what you would do...  I've been programming in a vacuum for quite a
> while. :-(
> 
> 
> > >>> from twisted.spread import jelly
> > >>> class Foo: pass
> > ... 
> > >>> f = Foo()
> > >>> f.bar = Foo
> > >>> jelly.jelly(f)
> > ['__main__.Foo', ['dictionary', ['bar', ['class', '__main__.Foo']]]]
> > 
> >   So far, so good.
> > 
> > >>> from twisted.spread import pb     
> > >>> class Foo(pb.Copyable):
> > ...     pass
> > ... 
> > >>> f = Foo()
> > >>> f.bar = Foo
> > >>> jelly.jelly(f)
> > ['__main__.Foo', ['dictionary', ['bar', ['class', '__main__.Foo']]]]
> > 
> >   Hmm, that works too.  I expected it not to, actually.  I suppose
> >   something you're doing with globalSecurity or setCopierForClassTree()
> >   may be mucking things up.
> 
> This test case doesn't seem quite right...  Why doesn't it fail since Foo
> hasn't been registered?  Hmmm, looks like jelly()'s taster arg defaults to
> DummySecurityOptions()...
> 
> What about registering Foo, and then calling with jelly.globalSecurity?:
> ---- Code ----
> from twisted.spread import jelly, pb
> 
> class Foo( pb.Copyable ):  pass
> jelly.setUnjellyableForClass( Foo, Foo )
> #jelly.globalSecurity.allowInstancesOf( Foo )  # uncomment to fix
> 
> if __name__ == '__main__':
>     f = Foo()
>     f.bar = Foo
>     print jelly.jelly( f, taster=jelly.globalSecurity )
> 
> ---- End Code ----
> 
> This gives the Insecure Jelly exception I'm seeing, from jelly.py:482...
> However, comment out `f.bar = Foo` or uncomment allowInstancesOf() and it
> works.
> 
> Oh, and I'm using twisted 1.2 and python 2.3.3.
> 
> 
> [snip]
> >   Posting a demonstrative test case would be excellent :)  I suspect there
> >   is no bug in jelly, just a disagreement in expectations which can easily
> >   be resolved once there is a concrete example to talk about.
> 
> Is this a decent example?  As for a fix, it looks like the solution is there
> in SecurityOptions.allowsInstancesOf(), but that it's just not exposed.
> 
> -Jasper
> 
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Thu, 22 Apr 2004 03:56:47 -0700
> From: David Reid <dreid at dreid.org>
> Subject: [Twisted-Python] Unwinding the Twisted Web (a progress
> 	report)
> To: twisted-python <twisted-python at twistedmatrix.com>,	twisted-web
> 	<twisted-web at twistedmatrix.com>
> Message-ID: <1082631407.28634.20.camel at localhost>
> Content-Type: text/plain
> 
> I had been trying to straighten out the model for the split since my
> first post to twisted-web regarding it.  Now that radix, and exarkun
> have split twisted.news out of the core codebase as "lowdown". Since
> then I have begun work on my own source tree of twisted.web, the module
> has been split as "unwound" which is my proposed name as mentioned in
> the numerous naming threads (to be installed as tmlabs.unwound if
> desired.)  
> 
> So far I've done the following:
> 
>  * duplicate the source tree renaming the toplevel module and changing
> the imports accordingly.
> 
>  * run the tests (everything passes just as it does in twisted.web)
> 
>  * removed modules that were deprecated BY woven, and added a
> Deprecation Warning message to unwound.woven.__init__
> 
> If there are no complaints about this I'm asking someone (like radix) to
> help me complete the rest of the steps necessary to make this the
> official split so i can start working on changes and enhancements.  The
> things I can't do on my own, atleast not as part of twistedmatrix.com is
> setup the SVN repo and the project page.  
> 
> Also it appears if radix and exarkun did not solve (or atleast did not
> implmenet a solution for) the tap naming conflicts.  I.E. if lowdown or
> tmlabs.lowdown is going to use mktap news or mktap lowdown instead.
> 
> Other than that, Unwound is currently a useable tree of twisted.web At
> revision 10601.
> 
> (I'm open to changing the name to either tmlabs.web or some cute/catchy
> name other than 'unwound', but ultimately I think that is a policy
> decision that falls on the core twisted devs.)
> 
> --
> David Reid
> Claim to fame: "I actually wrote code that used twisted.web.webwidgets!"
> 
> 
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Thu, 22 Apr 2004 11:21:46 -0400
> From: Itamar Shtull-Trauring <itamar at itamarst.org>
> Subject: Re: [Twisted-Python] Unwinding the Twisted Web (a progress
> 	report)
> To: Twisted discussion stuff <twisted-python at twistedmatrix.com>
> Cc: twisted-web at twistedmatrix.com
> Message-ID: <1082647306.27964.10.camel at sheriffpony>
> Content-Type: text/plain
> 
> On Thu, 2004-04-22 at 06:56, David Reid wrote:
> 
> > So far I've done the following:
> > 
> >  * duplicate the source tree renaming the toplevel module and changing
> > the imports accordingly.
> 
> >From what I've gathered from talking to Donovan and James this is *not*
> how the new twisted.web version is going to be developed. Donovan said
> he'd write out a roadmap for the mailing list after talking it over.
> 
> -- 
> Itamar Shtull-Trauring    http://itamarst.org
> Looking for a job -- http://itamarst.org/resume.html
> 
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Thu, 22 Apr 2004 10:46:30 -0500
> From: "john nielsen" <jn at who.net>
> Subject: [Twisted-Python] how to have a server talk to a server
> To: twisted-python at twistedmatrix.com
> Message-ID: <20040422154630.2989779004F at ws1-14.us4.outblaze.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> I see some examples where you have  a client call pb.PBClientFactory to talk to a server which called pb.PBServerFactory.
> 
> What if you have 2 servers (both running pb.PBServerFactory) that accept clients and also want to talk to each other? Would the first server  also make a pb.PBClientFactory to talk to the second server (seems like you would have to be careful to not leak descriptors since the reactor would never close).
> 
> There's probably a standard way to do it, that I just missed.
> 
> Thanks for any help,
> 
> john
> 
> -- 
> ___________________________________________________________
> Sign-up for Ads Free at Mail.com
> http://promo.mail.com/adsfreejump.htm
> 
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Thu, 22 Apr 2004 11:38:55 -0600
> From: Eric Mangold <teratorn at world-net.net>
> Subject: [Twisted-Python] Re: how to have a server talk to a server
> To: Twisted discussion stuff <twisted-python at twistedmatrix.com>
> Message-ID: <opr6vcm5nfi4eeqj at mail.oaktech.net>
> Content-Type: text/plain; format=flowed; charset=iso-8859-1
> 
> On Thu, 22 Apr 2004 10:46:30 -0500, john nielsen <jn at who.net> wrote:
> 
> > I see some examples where you have  a client call pb.PBClientFactory to 
> > talk to a server which called pb.PBServerFactory.
> >
> > What if you have 2 servers (both running pb.PBServerFactory) that accept 
> > clients and also want to talk to each other? Would the first server  
> > also make a pb.PBClientFactory to talk to the second server
> 
> Yes.
> 
> > (seems like you would have to be careful to not leak descriptors since 
> > the reactor would never close).
> 
> Not sure what you mean by that.
> 
> 	-Eric
> 
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 
> 
> End of Twisted-Python Digest, Vol 1, Issue 1218
> ***********************************************
> 

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm





More information about the Twisted-Python mailing list