On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote:
Hello,

I wanted to create simple web service to start learning more about D lang and compare with another languages. I have used "dub init -t vibe.d" to create basic example:

import vibe.vibe;

void main()
{
        auto settings = new HTTPServerSettings;
        settings.port = 8080;
        settings.bindAddresses = ["::1", "127.0.0.1"];
        listenHTTP(settings, &hello);

        logInfo("Please open http://127.0.0.1:8080/ in your browser.");
        runApplication();
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
        res.writeBody("Hello, World!");
}



I started the program with "dub" command and everything worked as I expected. Except that there were a lot "deprecation" warnings and long time to compile.But when I exit the service by ctrl + c and start again the program cannot start again with error message:

Failed to listen on ::1:8080
Failed to listen on 127.0.0.1:8080
Failed to listen for incoming HTTP connections on any of the supplied interfaces.

or

leaking eventcore driver because there are still active handles


Probably the application was terminated incorrectly. What should I do to ensure that the application closes properly?

Thank you in advance

I assume you are using vibe.d 0.8.4 or older. Please check whether adding this to dub.json solves your problem:

​"versions": [ "VibeHighEventPriority" ]

(Restart your pc)

Vibe.d 0.9 0 will be released soon. I hope it will work out of the box there.

Kind regards
Andre

Reply via email to