Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,4 @@ Thanks for everyone who reported a bug, suggested a feature and contributed to t
- **10/05/21 (v0.5.1)** - Fingerprints and Certificates in the examples were updated by [@Khoi Hoang
](https://github.com/khoih-prog). Thank you Khoi!
- **29/07/21 (v0.5.2)** - Merged PR by [ONLYstcm](https://github.com/ONLYstcm) which added a (configurable) timeout for connections. Thank you ONLYstcm.
- **29/07/21 (v0.5.3)** - Deleted unsafe copy and assignment operators in `WebsocketsClient`.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ArduinoWebsockets
version=0.5.2
version=0.5.3
author=Gil Maimon <[email protected]>
maintainer=Gil Maimon <[email protected]>
sentence=A library for writing modern Websockets applications with Arduino.
Expand Down
9 changes: 4 additions & 5 deletions src/tiny_websockets/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ namespace websockets {
WebsocketsClient();
WebsocketsClient(std::shared_ptr<network::TcpClient> client);

WebsocketsClient(const WebsocketsClient& other);
WebsocketsClient(const WebsocketsClient&& other);

WebsocketsClient& operator=(const WebsocketsClient& other);
WebsocketsClient& operator=(const WebsocketsClient&& other);
WebsocketsClient(const WebsocketsClient& other) = delete;
WebsocketsClient(const WebsocketsClient&& other) = delete;
WebsocketsClient& operator=(const WebsocketsClient& other) = delete;
WebsocketsClient& operator=(const WebsocketsClient&& other) = delete;

void addHeader(const WSInterfaceString key, const WSInterfaceString value);

Expand Down
60 changes: 0 additions & 60 deletions src/websockets_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,66 +19,6 @@ namespace websockets {
// Empty
}

WebsocketsClient::WebsocketsClient(const WebsocketsClient& other) :
_client(other._client),
_endpoint(other._endpoint),
_connectionOpen(other._client->available()),
_messagesCallback(other._messagesCallback),
_eventsCallback(other._eventsCallback),
_sendMode(other._sendMode) {

// delete other's client
const_cast<WebsocketsClient&>(other)._client = nullptr;
const_cast<WebsocketsClient&>(other)._connectionOpen = false;
}

WebsocketsClient::WebsocketsClient(const WebsocketsClient&& other) :
_client(other._client),
_endpoint(other._endpoint),
_connectionOpen(other._client->available()),
_messagesCallback(other._messagesCallback),
_eventsCallback(other._eventsCallback),
_sendMode(other._sendMode) {

// delete other's client
const_cast<WebsocketsClient&>(other)._client = nullptr;
const_cast<WebsocketsClient&>(other)._connectionOpen = false;
}

WebsocketsClient& WebsocketsClient::operator=(const WebsocketsClient& other) {
// call endpoint's copy operator
_endpoint = other._endpoint;

// get callbacks and data from other
this->_client = other._client;
this->_messagesCallback = other._messagesCallback;
this->_eventsCallback = other._eventsCallback;
this->_connectionOpen = other._connectionOpen;
this->_sendMode = other._sendMode;

// delete other's client
const_cast<WebsocketsClient&>(other)._client = nullptr;
const_cast<WebsocketsClient&>(other)._connectionOpen = false;
return *this;
}

WebsocketsClient& WebsocketsClient::operator=(const WebsocketsClient&& other) {
// call endpoint's copy operator
_endpoint = other._endpoint;

// get callbacks and data from other
this->_client = other._client;
this->_messagesCallback = other._messagesCallback;
this->_eventsCallback = other._eventsCallback;
this->_connectionOpen = other._connectionOpen;
this->_sendMode = other._sendMode;

// delete other's client
const_cast<WebsocketsClient&>(other)._client = nullptr;
const_cast<WebsocketsClient&>(other)._connectionOpen = false;
return *this;
}

struct HandshakeRequestResult {
WSString requestStr;
WSString expectedAcceptKey;
Expand Down