diff --git a/src/AsyncEventSource.cpp b/src/AsyncEventSource.cpp index c56076df3..ad188e8fb 100644 --- a/src/AsyncEventSource.cpp +++ b/src/AsyncEventSource.cpp @@ -124,6 +124,7 @@ AsyncEventSourceMessage::~AsyncEventSourceMessage() { } size_t AsyncEventSourceMessage::ack(size_t len, uint32_t time) { + (void)time; // If the whole message is now acked... if(_acked + len > _len){ // Return the number of extra bytes acked (they will be carried on to the next message) @@ -161,8 +162,8 @@ AsyncEventSourceClient::AsyncEventSourceClient(AsyncWebServerRequest *request, A _client->setRxTimeout(0); _client->onError(NULL, NULL); - _client->onAck([](void *r, AsyncClient* c, size_t len, uint32_t time){ ((AsyncEventSourceClient*)(r))->_onAck(len, time); }, this); - _client->onPoll([](void *r, AsyncClient* c){ ((AsyncEventSourceClient*)(r))->_onPoll(); }, this); + _client->onAck([](void *r, AsyncClient* c, size_t len, uint32_t time){ (void)c; ((AsyncEventSourceClient*)(r))->_onAck(len, time); }, this); + _client->onPoll([](void *r, AsyncClient* c){ (void)c; ((AsyncEventSourceClient*)(r))->_onPoll(); }, this); _client->onData(NULL, NULL); _client->onTimeout([this](void *r, AsyncClient* c __attribute__((unused)), uint32_t time){ ((AsyncEventSourceClient*)(r))->_onTimeout(time); }, this); _client->onDisconnect([this](void *r, AsyncClient* c){ ((AsyncEventSourceClient*)(r))->_onDisconnect(); delete c; }, this); diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp index f8850218d..52dcd75f0 100644 --- a/src/AsyncWebSocket.cpp +++ b/src/AsyncWebSocket.cpp @@ -321,6 +321,7 @@ AsyncWebSocketBasicMessage::~AsyncWebSocketBasicMessage() { } void AsyncWebSocketBasicMessage::ack(size_t len, uint32_t time) { + (void)time; _acked += len; if(_sent == _len && _acked == _ack){ _status = WS_MSG_SENT; @@ -416,6 +417,7 @@ AsyncWebSocketMultiMessage::~AsyncWebSocketMultiMessage() { } void AsyncWebSocketMultiMessage::ack(size_t len, uint32_t time) { + (void)time; _acked += len; if(_sent >= _len && _acked >= _ack){ _status = WS_MSG_SENT; @@ -485,12 +487,12 @@ AsyncWebSocketClient::AsyncWebSocketClient(AsyncWebServerRequest *request, Async _lastMessageTime = millis(); _keepAlivePeriod = 0; _client->setRxTimeout(0); - _client->onError([](void *r, AsyncClient* c, int8_t error){ ((AsyncWebSocketClient*)(r))->_onError(error); }, this); - _client->onAck([](void *r, AsyncClient* c, size_t len, uint32_t time){ ((AsyncWebSocketClient*)(r))->_onAck(len, time); }, this); + _client->onError([](void *r, AsyncClient* c, int8_t error){ (void)c; ((AsyncWebSocketClient*)(r))->_onError(error); }, this); + _client->onAck([](void *r, AsyncClient* c, size_t len, uint32_t time){ (void)c; ((AsyncWebSocketClient*)(r))->_onAck(len, time); }, this); _client->onDisconnect([](void *r, AsyncClient* c){ ((AsyncWebSocketClient*)(r))->_onDisconnect(); delete c; }, this); - _client->onTimeout([](void *r, AsyncClient* c, uint32_t time){ ((AsyncWebSocketClient*)(r))->_onTimeout(time); }, this); - _client->onData([](void *r, AsyncClient* c, void *buf, size_t len){ ((AsyncWebSocketClient*)(r))->_onData(buf, len); }, this); - _client->onPoll([](void *r, AsyncClient* c){ ((AsyncWebSocketClient*)(r))->_onPoll(); }, this); + _client->onTimeout([](void *r, AsyncClient* c, uint32_t time){ (void)c; ((AsyncWebSocketClient*)(r))->_onTimeout(time); }, this); + _client->onData([](void *r, AsyncClient* c, void *buf, size_t len){ (void)c; ((AsyncWebSocketClient*)(r))->_onData(buf, len); }, this); + _client->onPoll([](void *r, AsyncClient* c){ (void)c; ((AsyncWebSocketClient*)(r))->_onPoll(); }, this); _server->_addClient(this); _server->_handleEvent(this, WS_EVT_CONNECT, request, NULL, 0); delete request; @@ -607,6 +609,7 @@ void AsyncWebSocketClient::ping(uint8_t *data, size_t len){ void AsyncWebSocketClient::_onError(int8_t){} void AsyncWebSocketClient::_onTimeout(uint32_t time){ + (void)time; _client->close(true); } @@ -1292,6 +1295,7 @@ void AsyncWebSocketResponse::_respond(AsyncWebServerRequest *request){ } size_t AsyncWebSocketResponse::_ack(AsyncWebServerRequest *request, size_t len, uint32_t time){ + (void)time; if(len){ new AsyncWebSocketClient(request, _server); } diff --git a/src/AsyncWebSocket.h b/src/AsyncWebSocket.h index 40cc03ffd..5b03aceb9 100644 --- a/src/AsyncWebSocket.h +++ b/src/AsyncWebSocket.h @@ -94,8 +94,8 @@ class AsyncWebSocketMessageBuffer { AsyncWebSocketMessageBuffer(const AsyncWebSocketMessageBuffer &); AsyncWebSocketMessageBuffer(AsyncWebSocketMessageBuffer &&); ~AsyncWebSocketMessageBuffer(); - void operator ++(int i) { _count++; } - void operator --(int i) { if (_count > 0) { _count--; } ; } + void operator ++(int i) { (void)i; _count++; } + void operator --(int i) { (void)i; if (_count > 0) { _count--; } ; } bool reserve(size_t size); void lock() { _lock = true; } void unlock() { _lock = false; } diff --git a/src/WebRequest.cpp b/src/WebRequest.cpp index fa06be667..bbce5ca4c 100644 --- a/src/WebRequest.cpp +++ b/src/WebRequest.cpp @@ -69,12 +69,12 @@ AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer* s, AsyncClient* c) , _itemIsFile(false) , _tempObject(NULL) { - c->onError([](void *r, AsyncClient* c, int8_t error){ AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onError(error); }, this); - c->onAck([](void *r, AsyncClient* c, size_t len, uint32_t time){ AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onAck(len, time); }, this); + c->onError([](void *r, AsyncClient* c, int8_t error){ (void)c; AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onError(error); }, this); + c->onAck([](void *r, AsyncClient* c, size_t len, uint32_t time){ (void)c; AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onAck(len, time); }, this); c->onDisconnect([](void *r, AsyncClient* c){ AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onDisconnect(); delete c; }, this); - c->onTimeout([](void *r, AsyncClient* c, uint32_t time){ AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onTimeout(time); }, this); - c->onData([](void *r, AsyncClient* c, void *buf, size_t len){ AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onData(buf, len); }, this); - c->onPoll([](void *r, AsyncClient* c){ AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onPoll(); }, this); + c->onTimeout([](void *r, AsyncClient* c, uint32_t time){ (void)c; AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onTimeout(time); }, this); + c->onData([](void *r, AsyncClient* c, void *buf, size_t len){ (void)c; AsyncWebServerRequest *req = (AsyncWebServerRequest*)r; req->_onData(buf, len); }, this); + c->onPoll([](void *r, AsyncClient* c){ (void)c; AsyncWebServerRequest *req = ( AsyncWebServerRequest*)r; req->_onPoll(); }, this); } AsyncWebServerRequest::~AsyncWebServerRequest(){ @@ -208,10 +208,11 @@ void AsyncWebServerRequest::_onAck(size_t len, uint32_t time){ } void AsyncWebServerRequest::_onError(int8_t error){ - + (void)error; } void AsyncWebServerRequest::_onTimeout(uint32_t time){ + (void)time; //os_printf("TIMEOUT: %u, state: %s\n", time, _client->stateToString()); _client->close(); } diff --git a/src/WebResponses.cpp b/src/WebResponses.cpp index 272ab7065..a22e991aa 100644 --- a/src/WebResponses.cpp +++ b/src/WebResponses.cpp @@ -161,7 +161,7 @@ bool AsyncWebServerResponse::_finished() const { return _state > RESPONSE_WAIT_A bool AsyncWebServerResponse::_failed() const { return _state == RESPONSE_FAILED; } bool AsyncWebServerResponse::_sourceValid() const { return false; } void AsyncWebServerResponse::_respond(AsyncWebServerRequest *request){ _state = RESPONSE_END; request->client()->close(); } -size_t AsyncWebServerResponse::_ack(AsyncWebServerRequest *request, size_t len, uint32_t time){ return 0; } +size_t AsyncWebServerResponse::_ack(AsyncWebServerRequest *request, size_t len, uint32_t time){ (void)request; (void)len; (void)time; return 0; } /* * String/Code Response @@ -213,6 +213,7 @@ void AsyncBasicResponse::_respond(AsyncWebServerRequest *request){ } size_t AsyncBasicResponse::_ack(AsyncWebServerRequest *request, size_t len, uint32_t time){ + (void)time; _ackedLength += len; if(_state == RESPONSE_CONTENT){ size_t available = _contentLength - _sentLength; @@ -261,6 +262,7 @@ void AsyncAbstractResponse::_respond(AsyncWebServerRequest *request){ } size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, uint32_t time){ + (void)time; if(!_sourceValid()){ _state = RESPONSE_FAILED; request->client()->close();