On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote:
And the most strange thing is this

It is echo-server/echo-client pair.
And it is echo-client that crashes upon SIGINT.

echo-server contains very similar code

class Listener : StageMachine {

    enum ulong M0_WORK = 0;
    enum ulong M1_WORK = 1;
    enum ulong M0_GONE = 0;

    RestRoom workerPool;
    ushort port;
    TCPListener reception;
    Signal sg0, sg1;

    this(RestRoom wPool, ushort port = 1111) {
        super("LISTENER");
        workerPool = wPool;
        this.port = port;

        Stage init, work;
        init = addStage("INIT", &listenerInitEnter);
        work = addStage("WORK", &listenerWorkEnter);

        init.addReflex("M0", work);

        work.addReflex("L0", &listenerWorkL0);
        work.addReflex("M0", &listenerWorkM0);
        work.addReflex("S0", &listenerWorkS0);
        work.addReflex("S1", &listenerWorkS1);
    }

    void listenerInitEnter() {
        reception = newTCPListener(port);
        sg0 = newSignal(Signal.sigInt);
        sg1 = newSignal(Signal.sigTerm);
        msgTo(this, M0_WORK);
    }

but it does not crashes (destruc).

The only significant difference - it has TCPListener instance, besides absolutely the same sg0 and sg1 'channels'.

Reply via email to