dexter has uploaded this change for review.

View Change

onomondo_eim_app: use individual instance name per HTTP server

The functions cowboy:start_clear and cowboy:start_tls get an
instance name (atom) as the first parameter. This instance
name must be unique. We mostly start the ESipa interface with
HTTPs enabled and the REST interface with HTTPs disabled, so
we get unique instance names in that case by chance. As soon
as we switch to HTTP on the ESipa interface as well, the eIM
crashes on startup, because the instance name
"http_listener_esipa" is used twice (and it's also a wrong
name in the case of the REST api). Let's ensure that each
HTTP(s) server gehts an indvidual instance name based on the
interface name.

Change-Id: I43be5666658c407fa1c1fe1a93ae61e428393218
Related: SYS#8287
---
M src/onomondo_eim_app.erl
1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/21/43921/1
diff --git a/src/onomondo_eim_app.erl b/src/onomondo_eim_app.erl
index a8614d7..688f83a 100644
--- a/src/onomondo_eim_app.erl
+++ b/src/onomondo_eim_app.erl
@@ -13,7 +13,7 @@
start_http_server(true, Ip, Port, _Cert, _Key, Dispatch, Middlewares, InterfaceName) ->
logger:notice("Starting ~s HTTP server at ~p:~p...~n", [InterfaceName, Ip, Port]),
cowboy:start_clear(
- http_listener_esipa,
+ list_to_atom("http_listener_" ++ InterfaceName),
[
{ip, Ip},
{port, Port}
@@ -35,7 +35,7 @@
% implementation still lacks SNI support. The effort required to add SNI support should be manageable as Cowboy
% offers SNI support (sni_fun).
cowboy:start_tls(
- https_listener_esipa,
+ list_to_atom("https_listener_" ++ InterfaceName),
[
{ip, Ip},
{port, Port},

To view, visit change 43921. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: onomondo-eim
Gerrit-Branch: master
Gerrit-Change-Id: I43be5666658c407fa1c1fe1a93ae61e428393218
Gerrit-Change-Number: 43921
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>