mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
SocketAcceptor::setReactor() is broken #2308
This commit is contained in:
parent
1d08872981
commit
479bde1e46
@ -105,12 +105,7 @@ public:
|
||||
void setReactor(SocketReactor& reactor)
|
||||
/// Sets the reactor for this acceptor.
|
||||
{
|
||||
_pReactor = &reactor;
|
||||
if (!_pReactor->hasEventHandler(_socket, Poco::Observer<SocketAcceptor,
|
||||
ReadableNotification>(*this, &SocketAcceptor::onAccept)))
|
||||
{
|
||||
registerAcceptor(reactor);
|
||||
}
|
||||
registerAcceptor(reactor);
|
||||
}
|
||||
|
||||
virtual void registerAcceptor(SocketReactor& reactor)
|
||||
@ -124,11 +119,12 @@ public:
|
||||
/// implementation or directly register the accept handler with
|
||||
/// the reactor.
|
||||
{
|
||||
if (_pReactor)
|
||||
throw Poco::InvalidAccessException("Acceptor already registered.");
|
||||
|
||||
_pReactor = &reactor;
|
||||
_pReactor->addEventHandler(_socket, Poco::Observer<SocketAcceptor, ReadableNotification>(*this, &SocketAcceptor::onAccept));
|
||||
if (!_pReactor->hasEventHandler(_socket, Poco::Observer<SocketAcceptor,
|
||||
ReadableNotification>(*this, &SocketAcceptor::onAccept)))
|
||||
{
|
||||
_pReactor->addEventHandler(_socket, Poco::Observer<SocketAcceptor, ReadableNotification>(*this, &SocketAcceptor::onAccept));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void unregisterAcceptor()
|
||||
|
Loading…
Reference in New Issue
Block a user