Skip to content

Conversation

rdumusc
Copy link

@rdumusc rdumusc commented Mar 21, 2017

The server now relies on a std::promise to check the success of a request to register for events instead of passively listening for a QSignal to come back. This change brings two improvements:

  • It fixes an issue with multiple clients, where all the clients were being notified when any of them tried to register, causing a warning message to be printed.
  • The Stream client is notified also if the request is not handled at all by the Server application (broken promise).

The server now relies on a std::promise to check the success of a
request to register for events instead of passively listening for
a QSignal to come back. This change brings two improvements:

- It fixes an issue with multiple clients, where all the clients
  were being notified when any of them tried to register, causing
  a warning message to be printed.
- The Stream client is notified also if the request is not handled
  at all by the Server application (broken promise).
Copy link
Contributor

@hernando hernando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel qualified to judge this change. You will need to explain it to me in person.

{
_registeredToEvents = future.get();
}
catch (...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catch broken promise instead of anything?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it safer to catch everything in case the promise holds an exception instead of a value. In all cases, it is reasonable to assume that if an exception happens then the registration must have failed.

@rdumusc rdumusc merged commit ce15eaa into BlueBrain:master Mar 21, 2017
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.

3 participants