gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: end gracefully when port isn't free


From: gnunet
Subject: [libeufin] branch master updated: end gracefully when port isn't free
Date: Thu, 28 Jan 2021 23:30:18 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new f1417a7  end gracefully when port isn't free
f1417a7 is described below

commit f1417a7334806708d901d805b768bdbce6e74958
Author: MS <ms@taler.net>
AuthorDate: Thu Jan 28 23:30:13 2021 +0100

    end gracefully when port isn't free
---
 debian/libeufin/etc/systemd/system/nexus.service              | 11 -----------
 debian/libeufin/etc/systemd/system/sandbox.service            | 11 -----------
 .../src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt |  9 ++++++++-
 sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt         | 10 ++++++++--
 4 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/debian/libeufin/etc/systemd/system/nexus.service 
b/debian/libeufin/etc/systemd/system/nexus.service
deleted file mode 100644
index 96c40d4..0000000
--- a/debian/libeufin/etc/systemd/system/nexus.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=LibEuFin Nexus service.
-
-[Service]
-EnvironmentFile=/etc/libeufin/libeufinenv.conf
-User=libeufin
-ExecStart=/usr/bin/libeufin-nexus serve --port=$LIBEUFIN_NEXUS_PORT
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target
diff --git a/debian/libeufin/etc/systemd/system/sandbox.service 
b/debian/libeufin/etc/systemd/system/sandbox.service
deleted file mode 100644
index 8d1e304..0000000
--- a/debian/libeufin/etc/systemd/system/sandbox.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=LibEuFin Sandbox service.
-
-[Service]
-EnvironmentFile=/etc/libeufin/libeufinenv.conf
-User=libeufin
-ExecStart=/usr/bin/libeufin-sandbox serve --port=$LIBEUFIN_SANDBOX_PORT
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index fc08971..fa2c274 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -50,7 +50,9 @@ import tech.libeufin.nexus.bankaccount.*
 import tech.libeufin.nexus.ebics.*
 import tech.libeufin.nexus.iso20022.CamtBankAccountEntry
 import tech.libeufin.util.*
+import java.net.BindException
 import java.net.URLEncoder
+import kotlin.system.exitProcess
 
 /**
  * Return facade state depending on the type.
@@ -1040,5 +1042,10 @@ fun serverMain(dbName: String, host: String, port: Int) {
         }
     }
     logger.info("LibEuFin Nexus running on port $port")
-    server.start(wait = true)
+    try {
+        server.start(wait = true)
+    } catch (e: BindException) {
+        logger.error(e.message)
+        exitProcess(1)
+    }
 }
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 43111c6..5a21ebb 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -83,8 +83,10 @@ import 
tech.libeufin.sandbox.BankAccountTransactionsTable.pmtInfId
 import tech.libeufin.util.*
 import tech.libeufin.util.ebics_h004.EbicsResponse
 import tech.libeufin.util.ebics_h004.EbicsTypes
+import java.net.BindException
 import java.util.*
 import kotlin.random.Random
+import kotlin.system.exitProcess
 
 val SANDBOX_DB_ENV_VAR_NAME = "LIBEUFIN_SANDBOX_DB_CONNECTION"
 private val logger: Logger = LoggerFactory.getLogger("tech.libeufin.sandbox")
@@ -238,7 +240,6 @@ fun serverMain(dbName: String, port: Int) {
                     HttpStatusCode.InternalServerError
                 )
             }
-
             exception<EbicsRequestError> { cause ->
                 val resp = EbicsResponse.createForUploadWithError(
                     cause.errorText,
@@ -570,5 +571,10 @@ fun serverMain(dbName: String, port: Int) {
         }
     }
     logger.info("LibEuFin Sandbox running on port $port")
-    server.start(wait = true)
+    try {
+        server.start(wait = true)
+    } catch (e: BindException) {
+        logger.error(e.message)
+        exitProcess(1)
+    }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]