回覆: Re: 回覆: Re: 回覆: Re: [Twisted-web] How to wait for a deferred object?

Suet Lung Cheung suetlung2003 at yahoo.com.hk
Mon Dec 5 20:07:21 MST 2005

Thanks everybody, finally I've made it call the stopService(). However even I return a deferred in the stopService, it still quit before the callback is called. Can anyone give me an example of returning a deferred in stopService()? Thanks anyone.

Christopher Armstrong <radeex at gmail.com> »¡¡G ]On 12/5/05, Suet Lung Cheung  wrote:
> Hi Paul,
>      Thanks for your reply again. Your example works for me. I found the
> difference. I use a serviceCollection to include my service. Does it mean
> anything? my code is in this way...
>  application = service.Application('chatroom')
>  f = ChatService()
>  serviceCollection = service.IServiceCollection(application)
>  internet.TCPServer (1234,
> ChatFactoryFromService(f)).setServiceParent(serviceCollection)
> and I have implemented stopService() in ChatService. Is it different if I
> use serviceCollection? Thanks again.

It looks like the problem here is that you're not setting your
ChatService's service parent to the application (by the way, you don't
need to adapt to IServiceCollection - setServiceParent tries to adapt
to IServiceCollection itself).

application = service.Application('chatroom')
f = ChatService()

should sort you out.

  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |

Twisted-web mailing list
Twisted-web at twistedmatrix.com

 ëx¾€ÓÏ¢ - Yahoo! Messenger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20051206/d1d10d53/attachment.htm

More information about the Twisted-web mailing list