diff options
Diffstat (limited to 'Sluift')
| -rw-r--r-- | Sluift/SluiftClient.cpp | 5 | ||||
| -rw-r--r-- | Sluift/SluiftComponent.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Sluift/SluiftClient.cpp b/Sluift/SluiftClient.cpp index e8c43c9..5243ed0 100644 --- a/Sluift/SluiftClient.cpp +++ b/Sluift/SluiftClient.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2013-2017 Isode Limited. + * Copyright (c) 2013-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Sluift/SluiftClient.h> @@ -46,10 +46,13 @@ SluiftClient::~SluiftClient() { delete tracer; delete client; } void SluiftClient::connect() { + if (client->isActive()) { + throw Lua::Exception("Client is already connecting or connected"); + } rosterReceived = false; blockListReceived = false; disconnectedError = boost::optional<ClientError>(); client->connect(options); } diff --git a/Sluift/SluiftComponent.cpp b/Sluift/SluiftComponent.cpp index e1d1738..126562e 100644 --- a/Sluift/SluiftComponent.cpp +++ b/Sluift/SluiftComponent.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Sluift/SluiftComponent.h> @@ -39,10 +39,13 @@ SluiftComponent::~SluiftComponent() { delete tracer; delete component; } void SluiftComponent::connect(const std::string& host, int port) { + if (component->isActive()) { + throw Lua::Exception("Component is already connecting or connected"); + } disconnectedError = boost::optional<ComponentError>(); component->connect(host, port); } void SluiftComponent::setTraceEnabled(bool b) { |
Swift