August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)
The 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.
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.
TorrentService() -> new TorrentService component
Use TorrentService.getTorrentService(...) in preference as it returns an existing instance, or automatically creates a new one.
Warning!
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.
Registers a TorrentPatron with this service, creating an outbox connected to it
Main loop
Deregisters a TorrentPatron with this service, deleting its outbox
Send a message to a TorrentPatron
Got 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