@@ -297,7 +297,7 @@ AsyncWebSocketClient::AsyncWebSocketClient(AsyncClient *client, AsyncWebSocket *
297297
298298AsyncWebSocketClient::~AsyncWebSocketClient () {
299299 {
300- asyncsrv::lock_guard_type lock (_lock );
300+ asyncsrv::lock_guard_type lock (_queue_lock );
301301 _messageQueue.clear ();
302302 _controlQueue.clear ();
303303 }
@@ -313,7 +313,7 @@ void AsyncWebSocketClient::_clearQueue() {
313313void AsyncWebSocketClient::_onAck (size_t len, uint32_t time) {
314314 _lastMessageTime = millis ();
315315
316- asyncsrv::unique_lock_type lock (_lock );
316+ asyncsrv::unique_lock_type lock (_queue_lock );
317317
318318 async_ws_log_v (" [%s][%" PRIu32 " ] START ACK(%u, %" PRIu32 " ) Q:%u" , _server->url (), _clientId, len, time, _messageQueue.size ());
319319
@@ -357,7 +357,7 @@ void AsyncWebSocketClient::_onAck(size_t len, uint32_t time) {
357357}
358358
359359void AsyncWebSocketClient::_onPoll () {
360- asyncsrv::unique_lock_type lock (_lock );
360+ asyncsrv::unique_lock_type lock (_queue_lock );
361361
362362 if (!_client) {
363363 return ;
@@ -430,22 +430,22 @@ void AsyncWebSocketClient::_runQueue() {
430430}
431431
432432bool AsyncWebSocketClient::queueIsFull () const {
433- asyncsrv::lock_guard_type lock (_lock );
433+ asyncsrv::lock_guard_type lock (_queue_lock );
434434 return (_messageQueue.size () >= WS_MAX_QUEUED_MESSAGES) || (_status != WS_CONNECTED);
435435}
436436
437437size_t AsyncWebSocketClient::queueLen () const {
438- asyncsrv::lock_guard_type lock (_lock );
438+ asyncsrv::lock_guard_type lock (_queue_lock );
439439 return _messageQueue.size ();
440440}
441441
442442bool AsyncWebSocketClient::canSend () const {
443- asyncsrv::lock_guard_type lock (_lock );
443+ asyncsrv::lock_guard_type lock (_queue_lock );
444444 return _messageQueue.size () < WS_MAX_QUEUED_MESSAGES;
445445}
446446
447447bool AsyncWebSocketClient::_queueControl (uint8_t opcode, const uint8_t *data, size_t len, bool mask) {
448- asyncsrv::lock_guard_type lock (_lock );
448+ asyncsrv::lock_guard_type lock (_queue_lock );
449449
450450 if (!_client) {
451451 return false ;
@@ -462,7 +462,7 @@ bool AsyncWebSocketClient::_queueControl(uint8_t opcode, const uint8_t *data, si
462462}
463463
464464bool AsyncWebSocketClient::_queueMessage (AsyncWebSocketSharedBuffer buffer, uint8_t opcode, bool mask) {
465- asyncsrv::unique_lock_type lock (_lock );
465+ asyncsrv::unique_lock_type lock (_queue_lock );
466466
467467 if (!_client || !buffer || buffer->empty () || _status != WS_CONNECTED) {
468468 return false ;
@@ -546,7 +546,6 @@ void AsyncWebSocketClient::_onError(int8_t err) {
546546}
547547
548548void AsyncWebSocketClient::_onTimeout (uint32_t time) {
549- asyncsrv::lock_guard_type lock (_lock);
550549 if (!_client) {
551550 return ;
552551 }
@@ -555,7 +554,6 @@ void AsyncWebSocketClient::_onTimeout(uint32_t time) {
555554}
556555
557556void AsyncWebSocketClient::_onDisconnect () {
558- asyncsrv::lock_guard_type lock (_lock);
559557 async_ws_log_v (" [%s][%" PRIu32 " ] DISCONNECT" , _server->url (), _clientId);
560558 _status = WS_DISCONNECTED;
561559 _client = nullptr ;
@@ -951,22 +949,16 @@ bool AsyncWebSocketClient::binary(const __FlashStringHelper *data, size_t len) {
951949#endif
952950
953951IPAddress AsyncWebSocketClient::remoteIP () const {
954- asyncsrv::lock_guard_type lock (_lock);
955-
956952 if (!_client) {
957953 return IPAddress ((uint32_t )0U );
958954 }
959-
960955 return _client->remoteIP ();
961956}
962957
963958uint16_t AsyncWebSocketClient::remotePort () const {
964- asyncsrv::lock_guard_type lock (_lock);
965-
966959 if (!_client) {
967960 return 0 ;
968961 }
969-
970962 return _client->remotePort ();
971963}
972964
0 commit comments