@@ -509,8 +509,8 @@ class Socket {
509
509
510
510
class TimerController {
511
511
public:
512
- TimerController (TimerNode **timer_pp , double timeout , Socket *sock , TimerCallback callback )
513
- : timer_pp(timer_pp ), timeout(timeout ), socket_(sock ), callback(callback ) {}
512
+ TimerController (TimerNode **_timer_pp , double _timeout , Socket *_socket , TimerCallback _callback )
513
+ : timer_pp(_timer_pp ), timeout(_timeout ), socket_(_socket ), callback(std::move(_callback) ) {}
514
514
bool start () {
515
515
if (timeout != 0 && !*timer_pp) {
516
516
enabled = true ;
@@ -542,16 +542,16 @@ class Socket {
542
542
public:
543
543
class TimeoutSetter {
544
544
public:
545
- TimeoutSetter (Socket *socket, double timeout , const enum TimeoutType type )
546
- : socket_(socket), timeout(timeout ), type(type ) {
547
- if (timeout == 0 ) {
545
+ TimeoutSetter (Socket *socket, double _timeout , const enum TimeoutType _type )
546
+ : socket_(socket), timeout(_timeout ), type(_type ) {
547
+ if (_timeout == 0 ) {
548
548
return ;
549
549
}
550
550
for (uint8_t i = 0 ; i < SW_ARRAY_SIZE (timeout_type_list); i++) {
551
- if (type & timeout_type_list[i]) {
551
+ if (_type & timeout_type_list[i]) {
552
552
original_timeout[i] = socket->get_timeout (timeout_type_list[i]);
553
- if (timeout != original_timeout[i]) {
554
- socket->set_timeout (timeout , timeout_type_list[i]);
553
+ if (_timeout != original_timeout[i]) {
554
+ socket->set_timeout (_timeout , timeout_type_list[i]);
555
555
}
556
556
}
557
557
}
@@ -576,12 +576,13 @@ class Socket {
576
576
double original_timeout[sizeof (timeout_type_list)] = {};
577
577
};
578
578
579
- class timeout_controller : public TimeoutSetter {
579
+ class TimeoutController : public TimeoutSetter {
580
580
public:
581
- timeout_controller (Socket *socket, double timeout, const enum TimeoutType type)
582
- : TimeoutSetter(socket, timeout, type) {}
583
- bool has_timedout (const enum TimeoutType type) {
584
- SW_ASSERT_1BYTE (type);
581
+ TimeoutController (Socket *_socket, double _timeout, const enum TimeoutType _type)
582
+ : TimeoutSetter(_socket, _timeout, _type) {}
583
+
584
+ bool has_timedout (const enum TimeoutType _type) {
585
+ SW_ASSERT_1BYTE (_type);
585
586
if (timeout > 0 ) {
586
587
if (sw_unlikely (startup_time == 0 )) {
587
588
startup_time = microtime ();
@@ -591,7 +592,7 @@ class Socket {
591
592
socket_->set_err (ETIMEDOUT);
592
593
return true ;
593
594
}
594
- socket_->set_timeout (timeout - used_time, type );
595
+ socket_->set_timeout (timeout - used_time, _type );
595
596
}
596
597
}
597
598
return false ;
0 commit comments