mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-15 16:30:31 +02:00
first step for SSL (wss) support
This commit is contained in:
@ -74,7 +74,7 @@ void WebSockets::clientDisconnect(WSclient_t * client, uint16_t code, char * rea
|
||||
*/
|
||||
void WebSockets::sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * payload, size_t length, bool mask, bool fin, bool headerToPayload) {
|
||||
|
||||
if(!client->tcp.connected()) {
|
||||
if(client->tcp && !client->tcp->connected()) {
|
||||
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] not Connected!?\n", client->num);
|
||||
return;
|
||||
}
|
||||
@ -171,14 +171,14 @@ void WebSockets::sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * pay
|
||||
// header has be added to payload
|
||||
// payload is forced to reserved 14 Byte but we may not need all based on the length and mask settings
|
||||
// offset in payload is calculatetd 14 - headerSize
|
||||
client->tcp.write(&payload[(14 - headerSize)], (length + headerSize));
|
||||
client->tcp->write(&payload[(14 - headerSize)], (length + headerSize));
|
||||
} else {
|
||||
// send header
|
||||
client->tcp.write(&buffer[0], headerSize);
|
||||
client->tcp->write(&buffer[0], headerSize);
|
||||
|
||||
if(payload && length > 0) {
|
||||
// send payload
|
||||
client->tcp.write(&payload[0], length);
|
||||
client->tcp->write(&payload[0], length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -385,7 +385,7 @@ bool WebSockets::readWait(WSclient_t * client, uint8_t *out, size_t n) {
|
||||
size_t len;
|
||||
|
||||
while(n > 0) {
|
||||
if(!client->tcp.connected()) {
|
||||
if(client->tcp && !client->tcp->connected()) {
|
||||
DEBUG_WEBSOCKETS("[readWait] not connected!\n");
|
||||
return false;
|
||||
}
|
||||
@ -395,14 +395,14 @@ bool WebSockets::readWait(WSclient_t * client, uint8_t *out, size_t n) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!client->tcp.available()) {
|
||||
if(!client->tcp->available()) {
|
||||
#ifdef ESP8266
|
||||
delay(0);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
len = client->tcp.read((uint8_t*) out, n);
|
||||
len = client->tcp->read((uint8_t*) out, n);
|
||||
if(len) {
|
||||
t = millis();
|
||||
out += len;
|
||||
|
Reference in New Issue
Block a user