Comments (8)
cc: @aldenml
from frostwire-jlibtorrent.
I removed the support for now and to explain:
The plugins torrent_plugin and peer_plugin are added by default and the only reason having the plugin interface exposed is if you want to create a plugin from java to plug in libtorrent. But that is impossible in the current form, because there is no such thing like inheriting a class in java and then passing it to the native world.
In the future and if necessary, we could create the mechanisms to create plugins from java.
No plans for now.
from frostwire-jlibtorrent.
@aldenml does the issue of not being able to use it in the current form happen because of how that method interface takes a function as a parameter?
I see that every other method which receives a boost::function
as a parameter is also gone.
$ grep "(boost::function" *.cpp
alert_manager.cpp: void alert_manager::set_dispatch_function(boost::function<void(std::auto_ptr<alert>)> const& fun)
alert_manager.cpp: void dispatch_alert(boost::function<void(alert const&)> dispatcher
connection_queue.cpp: void connection_queue::enqueue(boost::function<void(int)> const& on_connect
session.cpp: void session::add_extension(boost::function<boost::shared_ptr<torrent_plugin>(torrent*, void*)> ext)
session.cpp: void session::set_alert_dispatch(boost::function<void(std::auto_ptr<alert>)> const& fun)
session_impl.cpp: void session_impl::set_alert_dispatch(boost::function<void(std::auto_ptr<alert>)> const& fun)
torrent.cpp: void torrent::add_extension(boost::function<boost::shared_ptr<torrent_plugin>(torrent*, void*)> const& ext
all of those you won't find on the swig interfaces.
from frostwire-jlibtorrent.
No, passing a boost::function parameters is another issue. This one is related to the impossibility of inherit from plugin in (swig)-java and pass the object to the native side.
from frostwire-jlibtorrent.
@bedeho was thinking of how to help you during lunch.
For now I believe it's really hard to do this on the frostwire-jlibtorrent
side as there are limitations on how to deal with boost::function
on the Java side.
I think your path of action should be the following: since you're doing something so level which is basically create an extension to libtorrent (and not just use it as a client, which is mainly the purpose of frostwire-jlibtorrent
), you ought to do the extension in C++, and then continue the rest of the work in java using the library.
Take a look at libtorrent.i
, around line 730, and once you have your extension ready, you should do something along these lines:
void add_lt_trackers_extension() {
$self->add_extension(&libtorrent::create_lt_trackers_plugin);
}
void add_smart_ban_extension() {
$self->add_extension(&libtorrent::create_smart_ban_plugin);
}
void add_bedeho_extension() {
$self->add_extension(&bedeho::create_my_extension_plugin);
}
and then use the java add_bedeho_extension()
function to activate it when you're starting the jlibtorrent session.
I took a brief look at what's implied with opening up the add_extension
function to Session, and it becomes a huge mess on the java side because of all the stuff that comes from boost, which doesn't map very well from C++ to Java due to genericity.
please correct me if I'm wrong @aldenml
from frostwire-jlibtorrent.
Thank you gubatron, yes, I also concluded that I have to make the extension itself in C++.
Before reading this, I had resigned to doing the libtorrent client in C++ as well, and then try to make some light weight bindings for bitcoinj instead, but I will give this approach a try as well.
The challenge would be to communicate with the extension itself from the Java jlibtorrent client. It is easy for the extension to send messages to the client, by simply extending the alert class as the document suggests, but the other way, that is how the client can control the extension, is then more difficult. Perhaps your swig code can create some bindings for this as well.
I think your main conclusion is right either way, jlibtorrent is best for building a traditional client, not extensions - which is actually quite reasonable, given that libtorrent has most
BEPs one could want directly implemented.
from frostwire-jlibtorrent.
you are spot on, you can extend the alert classes (I think @aldenml did some remarkably creative work there with reflection on the java side and preprocessor on the C++/Swig side you should take a look at if you go with that route, see CAST_ALERT_METHOD
), or just add new swig entry points and extend the api for your fork.
I'd try to stay away from coding the whole thing in C++, as you can imagine I'm a bit biased towards working mostly on the java side ;)
from frostwire-jlibtorrent.
Thanks, I prefer Java as well!
from frostwire-jlibtorrent.
Related Issues (20)
- version mismatch HOT 22
- Force recheck crashing for finished torrent HOT 4
- No implementation found for void com.frostwire.jlibtorrent.swig.libtorrent_jni.swig_module_init() HOT 1
- Adding a download with changed priorities doesn't recognize the new priorities if download was finished earlier. HOT 9
- Downloads are not compatible HOT 4
- Download issues in Samsung Galaxy devices HOT 9
- How to Compile in embedded system, the platform is arm32. HOT 1
- [desktop] Calling SessionManager stop() takes forever after torrent is finished HOT 8
- dhtNodes Always 0 HOT 26
- Docker script Q&A HOT 5
- Error in Vectors.byte_vector2string
- sessionManager.stats().dhtNodes() always 0 HOT 4
- How to merge libraries into one? HOT 2
- Pure virtual function called! On Android 10+ [Using version 1.2.16.0] HOT 1
- Upgrading to libtorrent 2.0, it's time. HOT 1
- Low memory bug HOT 3
- Is it possible use your libtorrent.i wrap a c# version? HOT 11
- native crash HOT 1
- Debugging libtorrent crash on Android HOT 3
- iOS compatibility? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from frostwire-jlibtorrent.