software-challenge / gui-electron

Electron GUI for the Software-Challenge Germany 2016 - 2020 (Source code publicized 2018)
https://www.software-challenge.de
4 stars 0 forks source link

Check if the Backend port is blocked #130

Open xeruf opened 4 years ago

xeruf commented 4 years ago
    this.backend = portfinder.getPortPromise({ port: 12000 })
      .then((port) => {
        return new Backend(port)
      })

This code assumes that port 12000 is open and doesn't even catch potential errors. If the port is blocked the GUI simply shows a whitescreen when trying to start a game without further information.

Yasamato commented 4 years ago

We don't have an fallback-strategie as far as I can see, so should we introduce some changes to our port-handling like saying we have default 12000 and if blocked, server will try to listen on 12001. If this is blocked/used aswell, we increment till 12010 or something like that.

I think this could be quite resonable regarding the needed effort to implement this.

Yasamato commented 4 years ago

Ah mir ist was aufgefallen: https://github.com/CAU-Kiel-Tech-Inf/socha-gui/blob/ba258d59b35f266966e758decad738b57f8ad046/src/api/asynchronous/AsyncApi.ts#L13-L19 hier ist Port 13050 und hier aber 12000 https://github.com/CAU-Kiel-Tech-Inf/socha-gui/blob/ba258d59b35f266966e758decad738b57f8ad046/src/api/synchronous/GameManagerWorkerInterface.ts#L27-L30

Das sieht mir verdächtig aus...

xeruf commented 4 years ago

Nein, der Server läuft auf 13050 und das Backend auf 12000, dass du das nach so langer Zeit in der Entwicklung noch nicht weißt ist beängstigend ^^ wir müssen das echt noch besser dokumentieren.

Aber scheinbar returned portfinder.getPortPromise sowieso den nächsten freien Port, das sollten wir mal anschauen - aber so oder so sollten Promise errors gehändelt werden.

SKoschnicke commented 4 years ago

portfinder sollte eigentlich einen freien Port finden. Die angegebenen Ports sind nur die Startpunkte für die Suche https://www.npmjs.com/package/portfinder