not send data if still in HTTP header handling

This commit is contained in:
Markus Sattler
2015-07-26 13:07:45 +02:00
parent afe1a2b9d3
commit 516b1047f8

View File

@ -63,6 +63,16 @@ 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) {
if(!client->tcp.connected()) {
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] not Connected!?\n", client->num);
return;
}
if(client->status != WSC_CONNECTED) {
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] not in WSC_CONNECTED state!?\n", client->num);
return;
}
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] ------- send massage frame -------\n", client->num);
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] fin: %u opCode: %u mask: %u length: %u\n", client->num, fin, opcode, mask, length);
@ -70,11 +80,6 @@ void WebSockets::sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * pay
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] text: %s\n", client->num, payload);
}
if(!client->tcp.connected()) {
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] not Connected!?\n", client->num);
return;
}
uint8_t maskKey[4] = { 0 };
uint8_t buffer[16] = { 0 };
uint8_t i = 0;