Hive2Hive / Android

Android application for Hive2Hive
MIT License
17 stars 7 forks source link

Create Network on Android #2

Open nicoruti opened 9 years ago

nicoruti commented 9 years ago

(pulled out from #1)

The mobile phone should be able to create a new P2P network. As of now, it can only bootstrap to an existing network. The creation of a P2P network only works in Wifi, as NAT traversal cannot be achieved in cellular networks for the 'initial' peer.

qing3gan commented 8 years ago

As of now, the mobile phone could be able to create a new P2P network, shared and Synchronize between Android device?

nicoruti commented 8 years ago

Yes, within the same Wifi, this would theoretically be possible (and not that hard to implement).

qing3gan commented 8 years ago

1.The tomp2p has changed,should i change the dependency of android client?(tomp2p's version is 5.0-Beta8,and android client use 5.0-Beta5) When I use client (PC uses MultiStableH2HPeer.java to open 5 Peer. Two-Android-client in the same WiFi environment using Full-Peer mode connect PC, sometimes there will be some exceptions, such as a file delete-on-phone and then download it or download shared file,that will be reported to java.util.concurrent.RejectedExecutionException, create a folder or add a file bigger then 3M will be reported to java.lang.OutOfMemoryError. 2.In short, in the process of using the client will appear some exceptions, is the Android client not too stable? 3.Android client to achieve the function of creating network is the same as the StablePeer implementation method? Or that a newer version of this feature has been released?

nicoruti commented 8 years ago

1.The tomp2p has changed,should i change the dependency of android client?(tomp2p's version is 5.0-Beta8,and android client use 5.0-Beta5)

You're right, TomP2P has done some beta releases meanwhile. Upgrading to the latest release could cause compatibility issues, as Hive2Hive 1.2.2 still uses Beta5. I don't know whether the two releases are compatible.

Two-Android-client in the same WiFi environment using Full-Peer mode connect PC, sometimes there will be some exceptions, such as a file delete-on-phone and then download it or download shared file,that will be reported to java.util.concurrent.RejectedExecutionException,

Could you post the full stack trace of this exception?

create a folder or add a file bigger then 3M will be reported to java.lang.OutOfMemoryError.

Creating a folder should not use that much memory. However, I sometimes also saw these exceptions during my tests. I think it has to do with buffers used by TomP2P that are not cleaned up properly. Since Beta5, TomP2P improved much on these issues, an upgrade could therefore resolve some issues. These OutOfMemory exceptions only appear on Android, as it's more restrictive when allocating large blocks of memory.

2.In short, in the process of using the client will appear some exceptions, is the Android client not too stable?

Yes, especially for large files, it's not very stable yet.

3.Android client to achieve the function of creating network is the same as the StablePeer implementation method? Or that a newer version of this feature has been released?

The major change would be to use NetworkConfiguration netConf = NetworkConfiguration.createInitial(); as the network configuration, instead of networkConfig = NetworkConfiguration.create(deviceId, bootstrapAddress, bootstrapPort).setPort(bindPort);.

PeerNAT (for relaying) and setting external addresses is not required, as this only works in Wifi anyway.

qing3gan commented 8 years ago

I have a new problem, if the P2P network does not exist, then the user‘s file  uploaded bofore are gone? If so, then how do I save the user's file in the case of the network restart?By the way,where is the answer of 'github.com/Hive2Hive/Hive2Hive/wiki/FAQ'?And how to use disk storage?

qing3gan commented 8 years ago

This is the full stack of java.util.concurrent.RejectedExecutionException when i do file delete-on-phone and then download it or download shared file(the file just 1.41M). And the pc which is run on linux use the deployment.jar reported [Netty-TOMP2P[WARN]]:TimeoutFactory--channel timeout for channel server. the pc config look like this:

  NumPeers = 5
  StartPort=4622
  ExternalAddress = 192.168.1.200
  AcceptData = true
  Relay {
    enabled = true
    GCM {           
        api-key = "your-api-key"
        buffer-age-limit = 20s
    }
 }

10-13 09:43:17.721 14933-15069/org.hive2hive.mobile D/org.hive2hive.processframework.ProcessComponent﹕ Executing 'Download File Process'. 10-13 09:43:17.721 14933-15069/org.hive2hive.mobile D/org.hive2hive.processframework.ProcessComponent﹕ Executing 'org.hive2hive.core.processes.files.download.FindInUserProfileStep'. 10-13 09:43:17.821 14933-15069/org.hive2hive.mobile D/org.hive2hive.processframework.ProcessComponent﹕ Executing 'org.hive2hive.core.processes.files.GetMetaFileStep'. 10-13 09:43:18.011 14933-15069/org.hive2hive.mobile D/org.hive2hive.processframework.ProcessComponent﹕ Executing 'org.hive2hive.core.processes.files.download.InitDownloadChunksStep'. 10-13 09:43:18.011 14933-15069/org.hive2hive.mobile E/org.hive2hive.processframework.ProcessComponent﹕ An exception has been catched during execution. See cause for more information. java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@486e8398 rejected from java.util.concurrent.ThreadPoolExecutor@4349aa38[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 2] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339) ~[na:0.0] at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:81) ~[na:0.0] at org.hive2hive.core.network.data.download.DownloadManager.schedule(DownloadManager.java:81) ~[na:0.0] at org.hive2hive.core.network.data.download.DownloadManager.submit(DownloadManager.java:61) ~[na:0.0] at org.hive2hive.core.processes.files.download.InitDownloadChunksStep.doExecute(InitDownloadChunksStep.java:94) ~[na:0.0] at org.hive2hive.core.processes.files.download.InitDownloadChunksStep.doExecute(InitDownloadChunksStep.java:1) ~[na:0.0] at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:70) ~[na:0.0] at org.hive2hive.processframework.composites.SyncProcess.doExecute(SyncProcess.java:55) ~[na:0.0] at org.hive2hive.processframework.composites.SyncProcess.doExecute(SyncProcess.java:1) ~[na:0.0] at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:70) ~[na:0.0] at org.hive2hive.mobile.files.tasks.BaseFileTask.doInBackground(BaseFileTask.java:46) ~[na:0.0] at org.hive2hive.mobile.files.tasks.BaseFileTask.doInBackground(BaseFileTask.java:18) ~[na:0.0] at android.os.AsyncTask$2.call(AsyncTask.java:288) ~[na:0.0] at java.util.concurrent.FutureTask.run(FutureTask.java:237) ~[na:0.0] at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) ~[na:0.0] at java.lang.Thread.run(Thread.java:841) ~[na:0.0] 10-13 09:43:18.021 14933-15069/org.hive2hive.mobile E/org.hive2hive.processframework.ProcessComponent﹕ An exception has been catched during execution. See cause for more information. org.hive2hive.processframework.exceptions.ProcessExecutionException: An exception has been catched during execution. See cause for more information. at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:83) ~[na:0.0] at org.hive2hive.processframework.composites.SyncProcess.doExecute(SyncProcess.java:55) ~[na:0.0] at org.hive2hive.processframework.composites.SyncProcess.doExecute(SyncProcess.java:1) ~[na:0.0] at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:70) ~[na:0.0] at org.hive2hive.mobile.files.tasks.BaseFileTask.doInBackground(BaseFileTask.java:46) ~[na:0.0] at org.hive2hive.mobile.files.tasks.BaseFileTask.doInBackground(BaseFileTask.java:18) ~[na:0.0] at android.os.AsyncTask$2.call(AsyncTask.java:288) ~[na:0.0] at java.util.concurrent.FutureTask.run(FutureTask.java:237) ~[na:0.0] at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) ~[na:0.0] at java.lang.Thread.run(Thread.java:841) ~[na:0.0] Caused by: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@486e8398 rejected from java.util.concurrent.ThreadPoolExecutor@4349aa38[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 2] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339) ~[na:0.0] at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:81) ~[na:0.0] at org.hive2hive.core.network.data.download.DownloadManager.schedule(DownloadManager.java:81) ~[na:0.0] at org.hive2hive.core.network.data.download.DownloadManager.submit(DownloadManager.java:61) ~[na:0.0] at org.hive2hive.core.processes.files.download.InitDownloadChunksStep.doExecute(InitDownloadChunksStep.java:94) ~[na:0.0] at org.hive2hive.core.processes.files.download.InitDownloadChunksStep.doExecute(InitDownloadChunksStep.java:1) ~[na:0.0] at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:70) ~[na:0.0] ... 11 common frames omitted 10-13 09:43:18.021 14933-15069/org.hive2hive.mobile E/org.hive2hive.mobile.files.tasks.BaseFileTask﹕ Cannot run the file process org.hive2hive.processframework.exceptions.ProcessExecutionException: An exception has been catched during execution. See cause for more information. at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:83) ~[na:0.0] at org.hive2hive.processframework.composites.SyncProcess.doExecute(SyncProcess.java:55) ~[na:0.0] at org.hive2hive.processframework.composites.SyncProcess.doExecute(SyncProcess.java:1) ~[na:0.0] at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:70) ~[na:0.0] at org.hive2hive.mobile.files.tasks.BaseFileTask.doInBackground(BaseFileTask.java:46) ~[na:0.0] at org.hive2hive.mobile.files.tasks.BaseFileTask.doInBackground(BaseFileTask.java:18) ~[na:0.0] at android.os.AsyncTask$2.call(AsyncTask.java:288) ~[na:0.0] at java.util.concurrent.FutureTask.run(FutureTask.java:237) ~[na:0.0] at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) ~[na:0.0] at java.lang.Thread.run(Thread.java:841) ~[na:0.0] Caused by: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@486e8398 rejected from java.util.concurrent.ThreadPoolExecutor@4349aa38[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 2] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339) ~[na:0.0] at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:81) ~[na:0.0] at org.hive2hive.core.network.data.download.DownloadManager.schedule(DownloadManager.java:81) ~[na:0.0] at org.hive2hive.core.network.data.download.DownloadManager.submit(DownloadManager.java:61) ~[na:0.0] at org.hive2hive.core.processes.files.download.InitDownloadChunksStep.doExecute(InitDownloadChunksStep.java:94) ~[na:0.0] at org.hive2hive.core.processes.files.download.InitDownloadChunksStep.doExecute(InitDownloadChunksStep.java:1) ~[na:0.0] at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:70) ~[na:0.0] ... 11 common frames omitted