Skip to content

Fixes issues #1-4#5

Open
sehe wants to merge 13 commits into
di9it:masterfrom
sehe:fixes
Open

Fixes issues #1-4#5
sehe wants to merge 13 commits into
di9it:masterfrom
sehe:fixes

Conversation

@sehe

@sehe sehe commented Jan 20, 2021

Copy link
Copy Markdown

See the respective tickets for #1, #3 and #4

The fixes for #2 entail many separate commits, for which see the changes list.

Tests now run / still run respectively. Documentation has been updated.

sehe added 11 commits January 20, 2021 00:55
This can be important. Also, realize that destruction order is the same
in reverse.
Note that there is missin error handling as the TODO already indicated
Avoid non standard code to allow portability.

Made the headers into a named struct and members. Reworded most _data
accesses to use `headers()` accessor.
Adds join to ~msghub_impl
Adds a work_ object to avoid prematurely exiting io_service
Graceful shutdown requires closing the hubconnection and any acceptor if
applicable. Only then will a join() complete.

Actually this needs bit more work, because one does not by default want
to cut operations in the middle of sending output.

I suggest giving `do_close` a bool flag `forced` to indicate whether
pending write operations (operations for which we own the initiative)
are to be forcibly interrupted.

Existing locations to invoke `do_close` in error conditions shall supply
`forced = true`. Other cases should default to `forced = false` so as to
make sure that simple client programs will work as expected:

```c++
    msghub msghub(io_service);
    msghub.connect("localhost", 1334);
    msghub.publish("Publish", "new message");
    //msghub.join(); // implied
```

Here the message should be expected to be delivered, regardless of
timings. Of course barring connectivity issues, in which case
`do_close(forced = true)` should happen because of the error condition.
@sehe sehe changed the title Fixes #1 #2 #3 #4 Fixes issues #1-4 Jan 20, 2021
@sehe sehe mentioned this pull request Feb 9, 2021
sehe added 2 commits February 9, 2021 23:44
To use:

    cmake .
    make
    make test

Run the example in separate terminals:

    ./examples/server
    ./examples/client
Somehow the runner was segfaulting with the CMake steps. Didn't want to
find out why, instead used the default runner main with auto test
suites/cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant