From 1d79c854373f144581a21aab120976d1a248bc75 Mon Sep 17 00:00:00 2001 From: Matt Bradbury Date: Fri, 27 Mar 2020 23:15:36 -0500 Subject: [PATCH 1/5] Fixed problem with path iterators --- .../rightmesh/libdtn/core/storage/SimpleStorage.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libdtn-core/src/main/java/io/left/rightmesh/libdtn/core/storage/SimpleStorage.java b/libdtn-core/src/main/java/io/left/rightmesh/libdtn/core/storage/SimpleStorage.java index 5f30018..0f99555 100644 --- a/libdtn-core/src/main/java/io/left/rightmesh/libdtn/core/storage/SimpleStorage.java +++ b/libdtn-core/src/main/java/io/left/rightmesh/libdtn/core/storage/SimpleStorage.java @@ -103,8 +103,8 @@ public void initComponent(ConfigurationApi conf, ConfigurationApi.CoreEntry entr storagePaths.stream() .filter(p -> !updated_paths.contains(p)) .map(pathsToRemove::add) - .count(); - pathsToRemove.stream().map(this::removePath).count(); + .count(); + pathsToRemove.forEach(x -> this.removePath(x)); /* add new path */ LinkedList pathsToAdd = new LinkedList<>(); @@ -112,7 +112,7 @@ public void initComponent(ConfigurationApi conf, ConfigurationApi.CoreEntry entr .filter(p -> !storagePaths.contains(p)) .map(pathsToAdd::add) .count(); - pathsToAdd.stream().map(this::addPath).count(); + pathsToAdd.stream().forEach( x -> this.addPath(x)); }); } @@ -370,13 +370,13 @@ Single store(Bundle bundle) { File fbundle; try { fbundle = createBundleFile(bundle.bid, size.get()); - } catch (StorageFullException sfe) { + } catch (StorageFullException sfe) { if (hasBlob) { bundle.getPayloadBlock().data = blob; } s.onError(new Throwable("storage is full")); return; - } + } /* actual serialization of the bundle */ OutputStream out = new BufferedOutputStream(new FileOutputStream(fbundle)); From c3a2cbe908cf7e6902523128ccb1f2bb34bb4dbe Mon Sep 17 00:00:00 2001 From: Matt Bradbury Date: Fri, 27 Mar 2020 23:18:21 -0500 Subject: [PATCH 2/5] Updated gradle version to allow newer JDK --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4c96a81..318d0ae 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip From 636efad109c2d85b4b03e7a65f5df941a6d6f085 Mon Sep 17 00:00:00 2001 From: Matt Bradbury Date: Fri, 27 Mar 2020 23:22:14 -0500 Subject: [PATCH 3/5] updated dependencies --- modules/core/libdtn-module-http/build.gradle | 10 +++++++++- modules/core/libdtn-module-http/gradle.properties | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/core/libdtn-module-http/build.gradle b/modules/core/libdtn-module-http/build.gradle index 479cc2c..455452f 100644 --- a/modules/core/libdtn-module-http/build.gradle +++ b/modules/core/libdtn-module-http/build.gradle @@ -35,8 +35,16 @@ dependencies { // lib rx netty for http ApiEid // note: we need to use compile keyword to add in the fatjar, implementation/api doesn't work - compile "io.reactivex:rxnetty-http:${rxnetty_version}" + compile group: 'io.reactivex', name: 'rxnetty-common', version: '0.5.2-rc.2' + compile group: 'io.reactivex', name: 'rxnetty-http', version: '0.5.2-rc.2' + compile "tv.cntt:jauter:${jauter_version}" + // // https://mvnrepository.com/artifact/io.reactivex/rxjava + compile group: 'io.reactivex', name: 'rxjava', version: '1.3.8' + + // https://mvnrepository.com/artifact/io.netty/netty-all + compile group: 'io.netty', name: 'netty-all', version: '4.1.48.Final' + } diff --git a/modules/core/libdtn-module-http/gradle.properties b/modules/core/libdtn-module-http/gradle.properties index da14b04..d9a9f2e 100644 --- a/modules/core/libdtn-module-http/gradle.properties +++ b/modules/core/libdtn-module-http/gradle.properties @@ -1,2 +1,3 @@ rxnetty_version=0.5.2-rc.2 jauter_version=1.7 +ionetty_version=4.1.48.Final From 60d293d0091c1f29764958d5f8c1d308f3d4d135 Mon Sep 17 00:00:00 2001 From: Matt Bradbury Date: Fri, 27 Mar 2020 23:42:22 -0500 Subject: [PATCH 4/5] Updated out of date command line. Formatting. --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2c57e23..ecfccb8 100644 --- a/README.md +++ b/README.md @@ -31,30 +31,30 @@ binaries: First you need to build the libraries, the modules and the applications: ``` - $ ./gradlew build && ./gradlew distTar + ./gradlew build && ./gradlew distTar ``` To run terra, which is the full-DTN daemon, go to the newly created build folder and run Terra by calling the terra script generated by gradle: ``` - $ cd linux/terra/build/distribution/ - $ tar xvf terra.tar - $ ./terra/bin/terra -h + cd linux/terra/build/distribution/ + tar xvf terra.tar + ./terra/bin/terra -h ``` By default terra runs no module and is pretty useless without convergence layer nor application agent. The directory to find the modules can be provided from the command line so we will first create ad-hoc directories to the module that we just compiled: ``` - $ ln -s ../../../../modules/core/libdtn-module-http/build/libs/ core-modules - $ ln -s ../../../../modules/cla/libdtn-module-stcp/build/libs/ cla-modules - $ ln -s ../../../../modules/aa/ldcp/libdtn-module-ldcp/build/libs/ aa-modules + ln -s ../../../../modules/core/libdtn-module-http/build/libs/ core-modules + ln -s ../../../../modules/cla/libdtn-module-stcp/build/libs/ cla-modules + ln -s ../../../../modules/aa/ldcp/libdtn-module-ldcp/build/libs/ aa-modules ``` we can then run an instance of Terra like so: ``` - $ ./terra/bin/terra -d -n cla-modules -a aa-modules -c core-modules -s VOLATILE + ./terra/bin/terra -v --module-cla=cla-modules --module-aa=aa-modules --module-core=core-modules \ --enable-modules=http --enable-modules=ldcp --enable-modules=stcp -d ``` ## Using dtncat to register to a sink and listen for bundles: @@ -62,16 +62,16 @@ we can then run an instance of Terra like so: Now we can use dtncat to register to a sink, send or receive bundle. just like Terra, gradle has generated a build folder and scripts for dtncat: ``` - $ cd linux/dtncat/build/distribution - $ tar xvf dtncat.tar - $ ./dtncat/bin/dtncat -h + cd linux/dtncat/build/distribution + tar xvf dtncat.tar + ./dtncat/bin/dtncat -h ``` dtncat is a light client and does not run DTN itself, it must connect to a DTN node like Terra to use dtn services. The following command will connect dtncat to a running instance of Terra, register for a sink and wait for incomming bundles: ``` - $ ./dtncat/bin/dtncat 127.0.0.1 4557 -l /test/recv/bundle + ./dtncat/bin/dtncat 127.0.0.1 4557 -l /test/recv/bundle sink registered. cookie: 31cb71b7-783a-4009-9e63-32d25edce9c1 ``` @@ -80,7 +80,7 @@ An application agent (AA) cannot register to a sink that was already registered For instance, if this process were killed, you could reattach to the registration like so: ``` - $ ./dtncat/bin/dtncat 127.0.0.1 4557 -l /test/recv/bundle -c 31cb71b7-783a-4009-9e63-32d25edce9c1 + ./dtncat/bin/dtncat 127.0.0.1 4557 -l /test/recv/bundle -c 31cb71b7-783a-4009-9e63-32d25edce9c1 re-attach to registered sink ``` @@ -90,11 +90,11 @@ For instance, if this process were killed, you could reattach to the registratio In another terminal, we will send a bundle to our listening instance of dtncat ``` - $ echo "hello" | ./dtncat/bin/dtncat 127.0.0.1 4557 -D api:me/test/recv/bundle + echo "hello" | ./dtncat/bin/dtncat 127.0.0.1 4557 -D api:me/test/recv/bundle bundle successfully sent to 127.0.0.1:4557 ``` -the -D options will set the destination EID for the bundle that wraps around standard input (in this case "hello). api:me is a special EID +the -D options will set the destination EID for the bundle that wraps around standard input (in this case "hello). *api:me* is a special EID that identifies the node on which the application-agent is registering to. If another instance of dtncat was running and actively listening for /test/recv/bundle, the bundle will be automatically delivered to it From f4a2813f4ba32dc21a6378f43ac0bfcb30128e20 Mon Sep 17 00:00:00 2001 From: Matt Bradbury Date: Fri, 27 Mar 2020 23:44:08 -0500 Subject: [PATCH 5/5] Updated out of date command line. Formatting. --- README.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2c57e23..75cf11f 100644 --- a/README.md +++ b/README.md @@ -31,30 +31,31 @@ binaries: First you need to build the libraries, the modules and the applications: ``` - $ ./gradlew build && ./gradlew distTar + ./gradlew build && ./gradlew distTar ``` To run terra, which is the full-DTN daemon, go to the newly created build folder and run Terra by calling the terra script generated by gradle: ``` - $ cd linux/terra/build/distribution/ - $ tar xvf terra.tar - $ ./terra/bin/terra -h + cd linux/terra/build/distribution/ + tar xvf terra.tar + ./terra/bin/terra -h ``` By default terra runs no module and is pretty useless without convergence layer nor application agent. The directory to find the modules can be provided from the command line so we will first create ad-hoc directories to the module that we just compiled: ``` - $ ln -s ../../../../modules/core/libdtn-module-http/build/libs/ core-modules - $ ln -s ../../../../modules/cla/libdtn-module-stcp/build/libs/ cla-modules - $ ln -s ../../../../modules/aa/ldcp/libdtn-module-ldcp/build/libs/ aa-modules + ln -s ../../../../modules/core/libdtn-module-http/build/libs/ core-modules + ln -s ../../../../modules/cla/libdtn-module-stcp/build/libs/ cla-modules + ln -s ../../../../modules/aa/ldcp/libdtn-module-ldcp/build/libs/ aa-modules ``` we can then run an instance of Terra like so: ``` - $ ./terra/bin/terra -d -n cla-modules -a aa-modules -c core-modules -s VOLATILE + ./terra/bin/terra -v --module-cla=cla-modules --module-aa=aa-modules --module-core=core-modules \ + --enable-modules=http --enable-modules=ldcp --enable-modules=stcp -d ``` ## Using dtncat to register to a sink and listen for bundles: @@ -62,16 +63,16 @@ we can then run an instance of Terra like so: Now we can use dtncat to register to a sink, send or receive bundle. just like Terra, gradle has generated a build folder and scripts for dtncat: ``` - $ cd linux/dtncat/build/distribution - $ tar xvf dtncat.tar - $ ./dtncat/bin/dtncat -h + cd linux/dtncat/build/distribution + tar xvf dtncat.tar + ./dtncat/bin/dtncat -h ``` dtncat is a light client and does not run DTN itself, it must connect to a DTN node like Terra to use dtn services. The following command will connect dtncat to a running instance of Terra, register for a sink and wait for incomming bundles: ``` - $ ./dtncat/bin/dtncat 127.0.0.1 4557 -l /test/recv/bundle + ./dtncat/bin/dtncat 127.0.0.1 4557 -l /test/recv/bundle sink registered. cookie: 31cb71b7-783a-4009-9e63-32d25edce9c1 ``` @@ -80,7 +81,7 @@ An application agent (AA) cannot register to a sink that was already registered For instance, if this process were killed, you could reattach to the registration like so: ``` - $ ./dtncat/bin/dtncat 127.0.0.1 4557 -l /test/recv/bundle -c 31cb71b7-783a-4009-9e63-32d25edce9c1 + ./dtncat/bin/dtncat 127.0.0.1 4557 -l /test/recv/bundle -c 31cb71b7-783a-4009-9e63-32d25edce9c1 re-attach to registered sink ``` @@ -90,11 +91,11 @@ For instance, if this process were killed, you could reattach to the registratio In another terminal, we will send a bundle to our listening instance of dtncat ``` - $ echo "hello" | ./dtncat/bin/dtncat 127.0.0.1 4557 -D api:me/test/recv/bundle + echo "hello" | ./dtncat/bin/dtncat 127.0.0.1 4557 -D api:me/test/recv/bundle bundle successfully sent to 127.0.0.1:4557 ``` -the -D options will set the destination EID for the bundle that wraps around standard input (in this case "hello). api:me is a special EID +the -D options will set the destination EID for the bundle that wraps around standard input (in this case "hello). *api:me* is a special EID that identifies the node on which the application-agent is registering to. If another instance of dtncat was running and actively listening for /test/recv/bundle, the bundle will be automatically delivered to it