the8472 / mldht

Bittorrent Mainline DHT implementation in java
Mozilla Public License 2.0
149 stars 45 forks source link

Android support? #28

Closed master255 closed 4 years ago

master255 commented 4 years ago

Your library is good and maybe even too good. But it is written in a java language that is only supported since version 8 of Android. There are still a lot of devices in the world with 4.4 Android and 5.0, 6.0 and 7.0, 7.1, what to do with them? Maybe rewrite your library for a more java supported language? I think this will only have a negative impact on the readability of the code, not its speed.

Снимок

Any programmer can write only for the latest versions of devices. Real skill - to write a library which all devices support.

atomashpolskiy commented 4 years ago

Thanks for the feedback, I appreciate it. I am strongly opposed to the idea of rewriting it to older versions of Java though, as deficient are not only the language constructs, but also the standard library itself. There is TTorrent, which is written in Java 6. Maybe you may try that one instead?

On Sat, 28 Mar 2020, 19:08 Oleg, notifications@github.com wrote:

Your library is good and maybe even too good. But it is written in a java language that is only supported since version 8 of Android. There are still a lot of devices in the world with 4.4 Android and 5.0, 6.0 and 7.0, 7.1, what to do with them? Maybe rewrite your library for a more java supported language? I think this will only have a negative impact on the readability of the code, not its speed.

[image: Снимок] https://user-images.githubusercontent.com/5380115/77827581-7e9b6d80-7127-11ea-8b0b-80ebf00e757e.PNG

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/the8472/mldht/issues/28, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4TJBS7K5RJEIEPNDKWGQ3RJYOIXANCNFSM4LVT6LHA .

master255 commented 4 years ago

@atomashpolskiy What devices will the library be used on? Do you understand that this completely excludes the Android platform?

the8472 commented 4 years ago

I do not intend to support java versions older than 8, in fact I am considering to move to 11 for whatever feature I'll add next (at the current development pace that's probably not going to happen soon though).

You can look at older revisions of the library. At some point, many years ago, there was java 6 support.

Other than that you could try forking it and ripping out the problematic constructs. The arrays class that you're seeing in your error already contains a fallback code path which you could make the default instead.

This library targets desktop and server class machines foremost. That it works on newer versions of android at all is a happy coincidence since I am not even testing in such an environment. Mobile also may have its own pitfalls with frequently changing IPs (switching between mobile and wifi) that can impact DHT performance and aren't well-tested. I mean I do support interface changes, but roaming may be more frequent on mobile than I have dealt with before.

master255 commented 4 years ago

Very bad news for billions of devices on Android, Android TV. Okay. Let's keep developing.

atomashpolskiy commented 4 years ago

@the8472, sorry for chiming in mate, I somehow managed to misread the repo name in the email notification subject and thought that this was opened in my repo :D Cheers

On Sat, 28 Mar 2020, 19:52 Oleg, notifications@github.com wrote:

Very bad news for billions of devices on Android, Android TV. Okay. Let's keep developing.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/the8472/mldht/issues/28#issuecomment-605487657, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4TJBV7XYRM4ELHHKUY3JTRJYTLRANCNFSM4LVT6LHA .

the8472 commented 4 years ago

I suspected as much, no problem.

master255 commented 4 years ago

@atomashpolskiy and Ttorrent not have DHT support https://github.com/mpetazzoni/ttorrent/issues/83 All very bad... I will be the pioneer of DHT for Android.

master255 commented 4 years ago

@the8472 Android uses version 8 of Java, but not all patterns are supported. You need to learn this and make a separate branch for Android devices. For example, Android does not support the Path class. To change it to File I need to rewrite half of the library. Your library is not used by anyone for this reason. I have 200+ stars on an abandoned project))) and more forks. Make a separate branch and rewrite your code using Android Studio to check compatibility.

the8472 commented 4 years ago

Your initial report was about ancient android versions. Are you saying the library does not work on current ones? If that's the case I would be willing to accept a PR that provides fallbacks (e.g. vja multi release jars), as long as they are not too invasive and don't compromise performance on regular linux builds.

master255 commented 4 years ago

@the8472 , Your library is too big and complex for me to write PR to it. I don't have time for this. I'm currently writing my library to download torrents for Android. It's easier for me to write my DHT module than to take yours. I'm sorry, but I can't help in coding. This is your library and it will be easier for you to correct the necessary classes and patterns. At this moment, your library can be used in very rare cases. I will use it as a guide. Thank you.

master255 commented 4 years ago

@the8472 Sorry, I can't use your library, even as a guide. For a few days I've been trying to figure out where to find the formula to calculate the closest Node and I can't. There's a jungle of auxiliary classes and methods everywhere and it's very confusing. Maybe you are a beginner programmer. You should learn to write code in a more understandable language. Or if you want speed so much, you should switch to the Assembler language. Nobody will understand you in this way, you will have maximum speed instead.

Later I will write for everyone where to find the DHT library for Android or where to start.

the8472 commented 4 years ago

If you have a question or request, please open a new issue.

If you want to philosophize about code and tell other people what to do: I am not interested. Closing as offtopic.