diff options
Diffstat (limited to 'Sluift/SluiftComponent.cpp')
-rw-r--r-- | Sluift/SluiftComponent.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Sluift/SluiftComponent.cpp b/Sluift/SluiftComponent.cpp index e1d1738..74728ee 100644 --- a/Sluift/SluiftComponent.cpp +++ b/Sluift/SluiftComponent.cpp @@ -1,3 +1,3 @@ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2018 Isode Limited. * All rights reserved. @@ -42,3 +42,6 @@ SluiftComponent::~SluiftComponent() { -void SluiftComponent::connect(const std::string& host, int port) { +void SluiftComponent::connect(const std::string& host, unsigned short port) { + if (component->isActive()) { + throw Lua::Exception("Component is already connecting or connected"); + } disconnectedError = boost::optional<ComponentError>(); @@ -77,3 +80,3 @@ void SluiftComponent::disconnect() { component->disconnect(); - while (component->isAvailable()) { + while (component->isActive()) { eventLoop->runUntilEvents(); @@ -104,3 +107,3 @@ boost::optional<SluiftComponent::Event> SluiftComponent::getNextEvent( // Wait for new events - while (!watchdog.getTimedOut() && currentIndex >= pendingEvents.size() && component->isAvailable()) { + while (!watchdog.getTimedOut() && currentIndex >= pendingEvents.size() && component->isActive()) { eventLoop->runUntilEvents(); @@ -109,3 +112,3 @@ boost::optional<SluiftComponent::Event> SluiftComponent::getNextEvent( // Finish if we're disconnected or timed out - if (watchdog.getTimedOut() || !component->isAvailable()) { + if (watchdog.getTimedOut() || !component->isActive()) { return boost::optional<Event>(); |