Skip to content

Commit 60cc04a

Browse files
committed
squash! squash! fixup! squash! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Code Quality: Address shadowing
Removed explicit template from scoped_lock in files already changed in this commit
1 parent 8bf8e46 commit 60cc04a

File tree

6 files changed

+191
-191
lines changed

6 files changed

+191
-191
lines changed

implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bool local_tcp_server_endpoint_impl::is_local() const {
4848

4949
void local_tcp_server_endpoint_impl::init(const endpoint_type& _local,
5050
boost::system::error_code& _error) {
51-
std::scoped_lock<std::mutex> its_lock(acceptor_mutex_);
51+
std::scoped_lock its_lock{acceptor_mutex_};
5252
init_unlocked(_local, _error);
5353
}
5454

@@ -83,7 +83,7 @@ void local_tcp_server_endpoint_impl::deinit() {
8383

8484
void local_tcp_server_endpoint_impl::start() {
8585

86-
std::scoped_lock<std::mutex> its_lock(acceptor_mutex_);
86+
std::scoped_lock its_lock{acceptor_mutex_};
8787
if (!acceptor_.is_open()) {
8888
boost::system::error_code its_error;
8989
init_unlocked(local_, its_error);
@@ -117,14 +117,14 @@ void local_tcp_server_endpoint_impl::stop() {
117117

118118
server_endpoint_impl::stop();
119119
{
120-
std::scoped_lock<std::mutex> its_lock(acceptor_mutex_);
120+
std::scoped_lock its_lock{acceptor_mutex_};
121121
if (acceptor_.is_open()) {
122122
boost::system::error_code its_error;
123123
acceptor_.close(its_error);
124124
}
125125
}
126126
{
127-
std::scoped_lock<std::mutex> its_lock(connections_mutex_);
127+
std::scoped_lock its_lock{connections_mutex_};
128128
for (const auto &c : connections_) {
129129
c.second->stop();
130130
}
@@ -140,7 +140,7 @@ bool local_tcp_server_endpoint_impl::send(const uint8_t *_data, uint32_t _size)
140140
msg << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>(_data[i]) << " ";
141141
VSOMEIP_INFO << msg.str();
142142
#endif
143-
std::scoped_lock<std::mutex> its_lock(mutex_);
143+
std::scoped_lock its_lock{mutex_};
144144
if (endpoint_impl::sending_blocked_) {
145145
return false;
146146
}
@@ -150,7 +150,7 @@ bool local_tcp_server_endpoint_impl::send(const uint8_t *_data, uint32_t _size)
150150

151151
connection::ptr its_connection;
152152
{
153-
std::scoped_lock<std::mutex> its_lock_inner(connections_mutex_);
153+
std::scoped_lock its_lock_inner{connections_mutex_};
154154
const auto its_iterator = connections_.find(its_client);
155155
if (its_iterator == connections_.end()) {
156156
return false;
@@ -210,7 +210,7 @@ bool local_tcp_server_endpoint_impl::add_connection(const client_t &_client,
210210
const std::shared_ptr<connection> &_connection) {
211211

212212
bool ret = false;
213-
std::scoped_lock<std::mutex> its_lock(connections_mutex_);
213+
std::scoped_lock its_lock{connections_mutex_};
214214
auto find_connection = connections_.find(_client);
215215
if (find_connection == connections_.end()) {
216216
connections_[_client] = _connection;
@@ -225,7 +225,7 @@ bool local_tcp_server_endpoint_impl::add_connection(const client_t &_client,
225225
void local_tcp_server_endpoint_impl::remove_connection(
226226
const client_t &_client) {
227227

228-
std::scoped_lock<std::mutex> its_lock(connections_mutex_);
228+
std::scoped_lock its_lock{connections_mutex_};
229229
connections_.erase(_client);
230230
}
231231

@@ -343,7 +343,7 @@ local_tcp_server_endpoint_impl::connection::get_socket_lock() {
343343
}
344344

345345
void local_tcp_server_endpoint_impl::connection::start() {
346-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
346+
std::scoped_lock its_lock{socket_mutex_};
347347
if (socket_.is_open()) {
348348
const std::size_t its_capacity(recv_buffer_.capacity());
349349
if (recv_buffer_size_ > its_capacity) {
@@ -401,7 +401,7 @@ void local_tcp_server_endpoint_impl::connection::start() {
401401
}
402402

403403
void local_tcp_server_endpoint_impl::connection::stop() {
404-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
404+
std::scoped_lock its_lock{socket_mutex_};
405405
is_stopped_ = true;
406406
if (socket_.is_open()) {
407407
#if defined(__linux__) || defined(ANDROID) || defined(__QNX__)
@@ -444,7 +444,7 @@ void local_tcp_server_endpoint_impl::connection::send_queued(
444444
bufs.push_back(boost::asio::buffer(its_end_tag));
445445

446446
{
447-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
447+
std::scoped_lock its_lock{socket_mutex_};
448448
boost::asio::async_write(
449449
socket_,
450450
bufs,
@@ -585,7 +585,7 @@ void local_tcp_server_endpoint_impl::connection::receive_cbk(
585585
}
586586
if (its_command_size && max_message_size_ != MESSAGE_SIZE_UNLIMITED
587587
&& its_command_size > max_message_size_) {
588-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
588+
std::scoped_lock its_lock{socket_mutex_};
589589
VSOMEIP_ERROR << "Received a local message which exceeds "
590590
<< "maximum message size (" << std::dec << its_command_size
591591
<< ") aborting! local: " << get_path_local() << " remote: "
@@ -840,7 +840,7 @@ local_tcp_server_endpoint_impl::connection::get_recv_buffer_capacity() const {
840840

841841
void
842842
local_tcp_server_endpoint_impl::connection::shutdown_and_close() {
843-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
843+
std::scoped_lock its_lock{socket_mutex_};
844844
shutdown_and_close_unlocked();
845845
}
846846

@@ -852,10 +852,10 @@ local_tcp_server_endpoint_impl::connection::shutdown_and_close_unlocked() {
852852
}
853853

854854
void local_tcp_server_endpoint_impl::print_status() {
855-
std::scoped_lock<std::mutex> its_lock(mutex_);
855+
std::scoped_lock its_lock{mutex_};
856856
connections_t its_connections;
857857
{
858-
std::scoped_lock<std::mutex> its_lock_inner(connections_mutex_);
858+
std::scoped_lock its_lock_inner{connections_mutex_};
859859
its_connections = connections_;
860860
}
861861
std::string its_local_path("TCP");

implementation/endpoints/src/tcp_client_endpoint_impl.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void tcp_client_endpoint_impl::restart(bool _force) {
8989
}
9090
std::string address_port_local;
9191
{
92-
std::scoped_lock<std::mutex> its_lock(self->socket_mutex_);
92+
std::scoped_lock its_lock{self->socket_mutex_};
9393
address_port_local = self->get_address_port_local();
9494
self->shutdown_and_close_socket_unlocked(true);
9595
self->recv_buffer_ = std::make_shared<message_buffer_t>(self->recv_buffer_size_initial_, 0);
@@ -208,7 +208,7 @@ void tcp_client_endpoint_impl::connect() {
208208
}
209209
std::size_t operations_cancelled;
210210
{
211-
std::scoped_lock<std::mutex> its_lock_inner(connecting_timer_mutex_);
211+
std::scoped_lock its_lock_inner{connecting_timer_mutex_};
212212
operations_cancelled = connecting_timer_.cancel();
213213
}
214214
if (operations_cancelled != 0) {
@@ -251,7 +251,7 @@ void tcp_client_endpoint_impl::connect() {
251251
<< "(" << its_error.value() << "): " << its_error.message();
252252
std::size_t operations_cancelled;
253253
{
254-
std::scoped_lock<std::mutex> its_lock_inner(connecting_timer_mutex_);
254+
std::scoped_lock its_lock_inner{connecting_timer_mutex_};
255255
operations_cancelled = connecting_timer_.cancel();
256256
}
257257
if (operations_cancelled != 0) {
@@ -267,7 +267,7 @@ void tcp_client_endpoint_impl::connect() {
267267
void tcp_client_endpoint_impl::receive() {
268268
message_buffer_ptr_t its_recv_buffer;
269269
{
270-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
270+
std::scoped_lock its_lock{socket_mutex_};
271271
its_recv_buffer = recv_buffer_;
272272
}
273273
auto self = std::dynamic_pointer_cast< tcp_client_endpoint_impl >(shared_from_this());
@@ -279,7 +279,7 @@ void tcp_client_endpoint_impl::receive() {
279279
void tcp_client_endpoint_impl::receive(message_buffer_ptr_t _recv_buffer,
280280
std::size_t _recv_buffer_size,
281281
std::size_t _missing_capacity) {
282-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
282+
std::scoped_lock its_lock{socket_mutex_};
283283
if(socket_->is_open()) {
284284
const std::size_t its_capacity(_recv_buffer->capacity());
285285
size_t buffer_size = its_capacity - _recv_buffer_size;
@@ -356,7 +356,7 @@ void tcp_client_endpoint_impl::send_queued(std::pair<message_buffer_ptr_t, uint3
356356
VSOMEIP_INFO << msg.str();
357357
#endif
358358
{
359-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
359+
std::scoped_lock its_lock{socket_mutex_};
360360
if (socket_->is_open()) {
361361
boost::asio::async_write(
362362
*socket_,
@@ -409,7 +409,7 @@ uint16_t tcp_client_endpoint_impl::get_local_port() const {
409409
uint16_t its_port(0);
410410

411411
// Local port may be zero, if no client ports are configured
412-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
412+
std::scoped_lock its_lock{socket_mutex_};
413413
if (socket_->is_open()) {
414414
boost::system::error_code its_error;
415415
endpoint_type its_local = socket_->local_endpoint(its_error);
@@ -426,7 +426,7 @@ uint16_t tcp_client_endpoint_impl::get_local_port() const {
426426
}
427427

428428
void tcp_client_endpoint_impl::set_local_port() {
429-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
429+
std::scoped_lock its_lock{socket_mutex_};
430430
boost::system::error_code its_error;
431431
if (socket_->is_open()) {
432432
endpoint_type its_endpoint = socket_->local_endpoint(its_error);
@@ -444,7 +444,7 @@ void tcp_client_endpoint_impl::set_local_port() {
444444

445445
void tcp_client_endpoint_impl::set_local_port(port_t _port) {
446446

447-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
447+
std::scoped_lock its_lock{socket_mutex_};
448448
if (!socket_->is_open()) {
449449
local_.port(_port);
450450
} else {
@@ -883,7 +883,7 @@ void tcp_client_endpoint_impl::handle_recv_buffer_exception(
883883
sending_blocked_ = true;
884884
}
885885
{
886-
std::scoped_lock<std::mutex> its_lock(connect_timer_mutex_);
886+
std::scoped_lock its_lock{connect_timer_mutex_};
887887
boost::system::error_code ec;
888888
connect_timer_.cancel(ec);
889889
}
@@ -913,7 +913,7 @@ void tcp_client_endpoint_impl::print_status() {
913913
}
914914
std::string local;
915915
{
916-
std::scoped_lock<std::mutex> its_lock(socket_mutex_);
916+
std::scoped_lock its_lock{socket_mutex_};
917917
local = get_address_port_local();
918918
its_receive_buffer_capacity = recv_buffer_->capacity();
919919
}

implementation/endpoints/src/udp_server_endpoint_impl.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,15 @@ void udp_server_endpoint_impl::receive_multicast(uint8_t _multicast_id) {
380380
bool udp_server_endpoint_impl::send_to(const std::shared_ptr<endpoint_definition> _target,
381381
const byte_t* _data, uint32_t _size) {
382382

383-
std::scoped_lock<std::mutex> its_lock(mutex_);
383+
std::scoped_lock its_lock{mutex_};
384384
endpoint_type its_target(_target->get_address(), _target->get_port());
385385
return send_intern(its_target, _data, _size);
386386
}
387387

388388
bool udp_server_endpoint_impl::send_error(const std::shared_ptr<endpoint_definition> _target,
389389
const byte_t* _data, uint32_t _size) {
390390

391-
std::scoped_lock<std::mutex> its_lock(mutex_);
391+
std::scoped_lock its_lock{mutex_};
392392
const endpoint_type its_target(_target->get_address(), _target->get_port());
393393
const auto its_target_iterator(find_or_create_target_unlocked(its_target));
394394
auto& its_data = its_target_iterator->second;
@@ -409,8 +409,8 @@ bool udp_server_endpoint_impl::send_error(const std::shared_ptr<endpoint_definit
409409

410410
bool udp_server_endpoint_impl::send_queued(const target_data_iterator_type _it) {
411411

412-
std::scoped_lock<std::mutex> its_last_sent_lock(last_sent_mutex_);
413-
std::scoped_lock<std::mutex> its_unicast_lock(unicast_mutex_);
412+
std::scoped_lock its_last_sent_lock{last_sent_mutex_};
413+
std::scoped_lock its_unicast_lock{unicast_mutex_};
414414

415415
const auto its_entry = _it->second.queue_.front();
416416
#if 0
@@ -564,19 +564,19 @@ void udp_server_endpoint_impl::leave_unlocked(const std::string& _address) {
564564

565565
void udp_server_endpoint_impl::add_default_target(service_t _service, const std::string& _address,
566566
uint16_t _port) {
567-
std::scoped_lock<std::mutex> its_lock(default_targets_mutex_);
567+
std::scoped_lock its_lock{default_targets_mutex_};
568568
endpoint_type its_endpoint(boost::asio::ip::address::from_string(_address), _port);
569569
default_targets_[_service] = its_endpoint;
570570
}
571571

572572
void udp_server_endpoint_impl::remove_default_target(service_t _service) {
573-
std::scoped_lock<std::mutex> its_lock(default_targets_mutex_);
573+
std::scoped_lock its_lock{default_targets_mutex_};
574574
default_targets_.erase(_service);
575575
}
576576

577577
bool udp_server_endpoint_impl::get_default_target(
578578
service_t _service, udp_server_endpoint_impl::endpoint_type& _target) const {
579-
std::scoped_lock<std::mutex> its_lock(default_targets_mutex_);
579+
std::scoped_lock its_lock{default_targets_mutex_};
580580
bool is_valid(false);
581581
auto find_service = default_targets_.find(_service);
582582
if (find_service != default_targets_.end()) {
@@ -838,7 +838,7 @@ bool udp_server_endpoint_impl::is_same_subnet(const boost::asio::ip::address& _a
838838
}
839839

840840
void udp_server_endpoint_impl::print_status() {
841-
std::scoped_lock<std::mutex> its_lock(mutex_);
841+
std::scoped_lock its_lock{mutex_};
842842

843843
VSOMEIP_INFO << "status use: " << std::dec << local_port_ << " number targets: " << std::dec
844844
<< targets_.size() << " recv_buffer: " << std::dec
@@ -877,7 +877,7 @@ bool udp_server_endpoint_impl::is_reliable() const {
877877

878878
std::string udp_server_endpoint_impl::get_address_port_local() const {
879879

880-
std::scoped_lock<std::mutex> its_lock(unicast_mutex_);
880+
std::scoped_lock its_lock{unicast_mutex_};
881881
std::string its_address_port;
882882
its_address_port.reserve(21);
883883
boost::system::error_code ec;
@@ -1017,7 +1017,7 @@ void udp_server_endpoint_impl::set_multicast_option(const boost::asio::ip::addre
10171017

10181018
boost::asio::ip::multicast::join_group its_join_option;
10191019
{
1020-
std::scoped_lock<std::mutex> its_lock_inner(local_mutex_);
1020+
std::scoped_lock its_lock_inner{local_mutex_};
10211021
if (is_v4_) {
10221022
its_join_option = boost::asio::ip::multicast::join_group(_address.to_v4(),
10231023
local_.address().to_v4());

0 commit comments

Comments
 (0)