Skip to content

Commit eba71dd

Browse files
committed
Removed uneeded function calls from public api
1 parent fa3d1e6 commit eba71dd

File tree

3 files changed

+4
-64
lines changed

3 files changed

+4
-64
lines changed

include/WS_Lite.h

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -83,34 +83,22 @@ namespace SL {
8383
class WSListener {
8484
std::shared_ptr<WSListenerImpl> Impl_;
8585
public:
86-
//when a connection is fully established. If onconnect is called, then a matching onDisconnection is guaranteed
87-
void onConnection(std::function<void(WSocket&, const std::unordered_map<std::string, std::string>&)>& handle);
8886
//when a connection is fully established. If onconnect is called, then a matching onDisconnection is guaranteed
8987
void onConnection(const std::function<void(WSocket&, const std::unordered_map<std::string, std::string>&)>& handle);
9088
//when a message has been received
91-
void onMessage(std::function<void(WSocket&, const WSMessage&)>& handle);
92-
//when a message has been received
9389
void onMessage(const std::function<void(WSocket&, const WSMessage&)>& handle);
9490
//when a socket is closed down for ANY reason. If onconnect is called, then a matching onDisconnection is guaranteed
95-
void onDisconnection(std::function<void(WSocket&, unsigned short, const std::string&)>& handle);
96-
//when a socket is closed down for ANY reason. If onconnect is called, then a matching onDisconnection is guaranteed
9791
void onDisconnection(const std::function<void(WSocket&, unsigned short, const std::string&)>& handle);
9892
//when a ping is received from a client
99-
void onPing(std::function<void(WSocket&, const unsigned char *, size_t)>& handle);
100-
//when a ping is received from a client
10193
void onPing(const std::function<void(WSocket&, const unsigned char *, size_t)>& handle);
10294
//when a pong is received from a client
103-
void onPong(std::function<void(WSocket&, const unsigned char *, size_t)>& handle);
104-
//when a pong is received from a client
10595
void onPong(const std::function<void(WSocket&, const unsigned char *, size_t)>& handle);
10696
//before onconnection is called, the conection is upgraded
107-
void onHttpUpgrade(std::function<void(WSocket&)>& handle);
108-
//before onconnection is called, the conection is upgraded
10997
void onHttpUpgrade(const std::function<void(WSocket&)>& handle);
11098
//the maximum payload size
11199
void set_MaxPayload(size_t bytes);
112100
//the maximum payload size
113-
unsigned long long int get_MaxPayload();
101+
size_t get_MaxPayload();
114102
//maximum time in seconds before a client is considered disconnected -- for reads
115103
void set_ReadTimeout(std::chrono::seconds seconds);
116104
//get the current read timeout in seconds
@@ -131,34 +119,22 @@ namespace SL {
131119
class WSClient {
132120
std::shared_ptr<WSClientImpl> Impl_;
133121
public:
134-
//when a connection is fully established. If onconnect is called, then a matching onDisconnection is guaranteed
135-
void onConnection(std::function<void(WSocket&, const std::unordered_map<std::string, std::string>&)>& handle);
136122
//when a connection is fully established. If onconnect is called, then a matching onDisconnection is guaranteed
137123
void onConnection(const std::function<void(WSocket&, const std::unordered_map<std::string, std::string>&)>& handle);
138124
//when a message has been received
139-
void onMessage(std::function<void(WSocket&, const WSMessage&)>& handle);
140-
//when a message has been received
141125
void onMessage(const std::function<void(WSocket&, const WSMessage&)>& handle);
142126
//when a socket is closed down for ANY reason. If onconnect is called, then a matching onDisconnection is guaranteed
143-
void onDisconnection(std::function<void(WSocket&, unsigned short, const std::string&)>& handle);
144-
//when a socket is closed down for ANY reason. If onconnect is called, then a matching onDisconnection is guaranteed
145127
void onDisconnection(const std::function<void(WSocket&, unsigned short, const std::string&)>& handle);
146128
//when a ping is received from a client
147-
void onPing(std::function<void(WSocket&, const unsigned char *, size_t)>& handle);
148-
//when a ping is received from a client
149129
void onPing(const std::function<void(WSocket&, const unsigned char *, size_t)>& handle);
150130
//when a pong is received from a client
151-
void onPong(std::function<void(WSocket&, const unsigned char *, size_t)>& handle);
152-
//when a pong is received from a client
153131
void onPong(const std::function<void(WSocket&, const unsigned char *, size_t)>& handle);
154132
//before onconnection is called, the conection is upgraded
155-
void onHttpUpgrade(std::function<void(WSocket&)>& handle);
156-
//before onconnection is called, the conection is upgraded
157133
void onHttpUpgrade(const std::function<void(WSocket&)>& handle);
158134
//the maximum payload size
159135
void set_MaxPayload(size_t bytes);
160136
//the maximum payload size
161-
unsigned long long int get_MaxPayload();
137+
size_t get_MaxPayload();
162138
//maximum time in seconds before a client is considered disconnected -- for reads
163139
void set_ReadTimeout(std::chrono::seconds seconds);
164140
//get the current read timeout in seconds

src/internal/ClientImpl.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -194,39 +194,21 @@ namespace SL {
194194
}
195195
}
196196

197-
void WSClient::onConnection(std::function<void(WSocket&, const std::unordered_map<std::string, std::string>&)>& handle) {
198-
Impl_->onConnection = handle;
199-
}
200197
void WSClient::onConnection(const std::function<void(WSocket&, const std::unordered_map<std::string, std::string>&)>& handle) {
201198
Impl_->onConnection = handle;
202199
}
203-
void WSClient::onMessage(std::function<void(WSocket&, const WSMessage&)>& handle) {
204-
Impl_->onMessage = handle;
205-
}
206200
void WSClient::onMessage(const std::function<void(WSocket&, const WSMessage&)>& handle) {
207201
Impl_->onMessage = handle;
208202
}
209-
void WSClient::onDisconnection(std::function<void(WSocket&, unsigned short, const std::string&)>& handle) {
210-
Impl_->onDisconnection = handle;
211-
}
212203
void WSClient::onDisconnection(const std::function<void(WSocket&, unsigned short, const std::string&)>& handle) {
213204
Impl_->onDisconnection = handle;
214205
}
215-
void WSClient::onPing(std::function<void(WSocket&, const unsigned char *, size_t)>& handle) {
216-
Impl_->onPing = handle;
217-
}
218206
void WSClient::onPing(const std::function<void(WSocket&, const unsigned char *, size_t)>& handle) {
219207
Impl_->onPing = handle;
220208
}
221-
void WSClient::onPong(std::function<void(WSocket&, const unsigned char *, size_t)>& handle) {
222-
Impl_->onPong = handle;
223-
}
224209
void WSClient::onPong(const std::function<void(WSocket&, const unsigned char *, size_t)>& handle) {
225210
Impl_->onPong = handle;
226211
}
227-
void WSClient::onHttpUpgrade(std::function<void(WSocket&)>& handle) {
228-
Impl_->onHttpUpgrade = handle;
229-
}
230212
void WSClient::onHttpUpgrade(const std::function<void(WSocket&)>& handle) {
231213
Impl_->onHttpUpgrade = handle;
232214
}
@@ -245,7 +227,7 @@ namespace SL {
245227
void WSClient::set_MaxPayload(size_t bytes) {
246228
Impl_->MaxPayload = bytes;
247229
}
248-
unsigned long long int WSClient::get_MaxPayload() {
230+
size_t WSClient::get_MaxPayload() {
249231
return Impl_->MaxPayload;
250232
}
251233

src/internal/ListenerImpl.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -118,39 +118,21 @@ namespace SL {
118118
Listen(Impl_, createsocket);
119119
}
120120
}
121-
void WSListener::onConnection(std::function<void(WSocket&, const std::unordered_map<std::string, std::string>&)>& handle) {
122-
Impl_->onConnection = handle;
123-
}
124121
void WSListener::onConnection(const std::function<void(WSocket&, const std::unordered_map<std::string, std::string>&)>& handle) {
125122
Impl_->onConnection = handle;
126123
}
127-
void WSListener::onMessage(std::function<void(WSocket&, const WSMessage&)>& handle) {
128-
Impl_->onMessage = handle;
129-
}
130124
void WSListener::onMessage(const std::function<void(WSocket&, const WSMessage&)>& handle) {
131125
Impl_->onMessage = handle;
132126
}
133-
void WSListener::onDisconnection(std::function<void(WSocket&, unsigned short, const std::string&)>& handle) {
134-
Impl_->onDisconnection = handle;
135-
}
136127
void WSListener::onDisconnection(const std::function<void(WSocket&, unsigned short, const std::string&)>& handle) {
137128
Impl_->onDisconnection = handle;
138129
}
139-
void WSListener::onPing(std::function<void(WSocket&, const unsigned char *, size_t)>& handle) {
140-
Impl_->onPing = handle;
141-
}
142130
void WSListener::onPing(const std::function<void(WSocket&, const unsigned char *, size_t)>& handle) {
143131
Impl_->onPing = handle;
144132
}
145-
void WSListener::onPong(std::function<void(WSocket&, const unsigned char *, size_t)>& handle) {
146-
Impl_->onPong = handle;
147-
}
148133
void WSListener::onPong(const std::function<void(WSocket&, const unsigned char *, size_t)>& handle) {
149134
Impl_->onPong = handle;
150135
}
151-
void WSListener::onHttpUpgrade(std::function<void(WSocket&)>& handle) {
152-
Impl_->onHttpUpgrade = handle;
153-
}
154136
void WSListener::onHttpUpgrade(const std::function<void(WSocket&)>& handle) {
155137
Impl_->onHttpUpgrade = handle;
156138
}
@@ -169,7 +151,7 @@ namespace SL {
169151
void WSListener::set_MaxPayload(size_t bytes) {
170152
Impl_->MaxPayload = bytes;
171153
}
172-
unsigned long long int WSListener::get_MaxPayload() {
154+
size_t WSListener::get_MaxPayload() {
173155
return Impl_->MaxPayload;
174156
}
175157

0 commit comments

Comments
 (0)