Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

join() never completes because of outstanding operations #4

Open
sehe opened this issue Jan 20, 2021 · 1 comment
Open

join() never completes because of outstanding operations #4

sehe opened this issue Jan 20, 2021 · 1 comment

Comments

@sehe
Copy link

sehe commented Jan 20, 2021

Even on a publish-only channel there will be an extant async_read via hubconnection.

On publishers there will be an accept loop.

Both need cancelling.

@sehe
Copy link
Author

sehe commented Jan 20, 2021

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:

    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 added a commit to sehe/msghub that referenced this issue Jan 20, 2021
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 added a commit to sehe/msghub that referenced this issue Jan 20, 2021
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.
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

No branches or pull requests

1 participant