mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-09-27 14:50:56 +02:00
Some code formatting
Fraction of commit 6ac642b019dda9bd703a5b9c35e6f1a5a7738aa9 of dumbfixes branch of 0xFEEDC0DE64 fork of ESPAsyncWebServer. Additionally, lock is no longer released between _clearQueue() and _runQueue() in _onAck().
This commit is contained in:
@@ -307,7 +307,6 @@ void AsyncWebSocketClient::_clearQueue()
|
||||
void AsyncWebSocketClient::_onAck(size_t len, uint32_t time){
|
||||
_lastMessageTime = millis();
|
||||
|
||||
{
|
||||
AsyncWebLockGuard l(_lock);
|
||||
|
||||
if (!_controlQueue.empty()) {
|
||||
@@ -330,7 +329,6 @@ void AsyncWebSocketClient::_onAck(size_t len, uint32_t time){
|
||||
}
|
||||
|
||||
_clearQueue();
|
||||
}
|
||||
|
||||
_runQueue();
|
||||
}
|
||||
@@ -428,18 +426,23 @@ void AsyncWebSocketClient::_queueMessage(std::shared_ptr<std::vector<uint8_t>> b
|
||||
_runQueue();
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::close(uint16_t code, const char * message){
|
||||
void AsyncWebSocketClient::close(uint16_t code, const char * message)
|
||||
{
|
||||
if(_status != WS_CONNECTED)
|
||||
return;
|
||||
if(code){
|
||||
|
||||
if(code)
|
||||
{
|
||||
uint8_t packetLen = 2;
|
||||
if(message != NULL){
|
||||
if (message != NULL)
|
||||
{
|
||||
size_t mlen = strlen(message);
|
||||
if(mlen > 123) mlen = 123;
|
||||
packetLen += mlen;
|
||||
}
|
||||
char * buf = (char*)malloc(packetLen);
|
||||
if(buf != NULL){
|
||||
if (buf != NULL)
|
||||
{
|
||||
buf[0] = (uint8_t)(code >> 8);
|
||||
buf[1] = (uint8_t)(code & 0xFF);
|
||||
if(message != NULL){
|
||||
|
Reference in New Issue
Block a user