HTTP server stops listening
System information
What is your operating system and version? Arch Linux
What is your version of GJS? 1.76.2
If the bug is related to GNOME Shell, what is your version of GNOME Shell? GNOME 44.3
Bug information
Steps to reproduce
The issue can be reproduced by running this example https://gitlab.gnome.org/GNOME/gjs/-/blob/master/examples/http-server.js.
Current behaviour
After entering the field, it will randomly refuse to connect. I couldn't find a pattern as to when it refuses to connect, but sometimes it would refuse to connect after 2 or 3 times entering the field and clicking on "Go back".
Expected behaviour
The server never stops listening or refuses to connect even after entering the field and pressing on "Go back" multiple times.
(I'm a GSoC student and I was working on an HTTP server demo for Workbench https://github.com/sonnyp/Workbench/issues/414)