BitTorrent Sharing ServiceThe TorrentService component provides a service that allows the sharing of a single BitTorrent Client with more than one component that might want to use it. Use the TorrentPatron component to make use of BitTorrent through this service. Generally, you should not create a TorrentService yourself. If one is needed, one will be created by TorrentPatron. If a TorrentService already exists, creating one yourself may crash Python (see the effects of creating two TorrentClient components in TorrentClient.py) The shutting down of this component (when it is no longer in use) is very ugly. How does it work?This component forwards messages from TorrentPatrons to a single TorrentClient it creates and also delivers responses from TorrentClient to the TorrentPatron appropriate to the response content. TorrentClient handles new torrent requests sequentially, so as long as we keep a record of what order the requests of TorrentPatrons were forwarded, we can work out who to send TorrentClient's response to. Then, since all further messages are assigned a torrentid by TorrentClient, we can route all messages labelled with a particular id to to the TorrentPatron that started that torrent. Kamaelia.Protocol.Torrent.TorrentService.TorrentServiceclass TorrentService(Axon.AdaptiveCommsComponent.AdaptiveCommsComponent)TorrentService() -> new TorrentService component Use TorrentService.getTorrentService(...) in preference as it returns an existing instance, or automatically creates a new one. Inboxes
Outboxes
Methods defined hereWarning! You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers. addClient(self, replyService)Registers a TorrentPatron with this service, creating an outbox connected to it main(self)Main loop removeClient(self, replyService)Deregisters a TorrentPatron with this service, deleting its outbox sendToClient(self, msg, replyService)Send a message to a TorrentPatron FeedbackGot a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording! Please leave you feedback here in reply to the documentation thread in the Kamaelia blog. -- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT |
Kamaelia
is an open source project originated from and guided by BBC
Research. For more information browse the site or get in
contact.
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved.