You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem when trying to register eventhandlers in an override of the SocketConnector::registerConnector method in a SocketConnector subclass.
SocketConnector::registerConnector is called from the SocketConnector class constructor and since the object is not yet an instance of the derived class, it is still an instance of the base class, the registerConnector method in the derived class is not called.
The text was updated successfully, but these errors were encountered:
the registerConnector method in the derived class is not called.
If you need to register additional event handlers, you can create SocketConnector (without reactor) first and then explicitly call registerConnector on it. If you really, really insist on doing it at construction time - since you already have the reactor, why not call addEventHandler() on it directly for your desired additional handlers?
Thank's for the suggestions, there is always another way to get there. Since I'm just playing around it really doesn't matter for me right now but for someone else maybe.
I read the comment in the code, included below, and thought it would work to override and register an eventhandler but the "The overriding method must call the baseclass implementation first." does not work for the case I tried because of how object instantiation works.
/// Registers the SocketConnector with a SocketReactor.
///
/// A subclass can override this and, for example, also register
/// an event handler for a timeout event.
///
/// The overriding method must call the baseclass implementation first.
There is a problem when trying to register eventhandlers in an override of the SocketConnector::registerConnector method in a SocketConnector subclass.
SocketConnector::registerConnector is called from the SocketConnector class constructor and since the object is not yet an instance of the derived class, it is still an instance of the base class, the registerConnector method in the derived class is not called.
The text was updated successfully, but these errors were encountered: