dcsctp: Migrating to using absl::bind_front

It is now allowed in WebRTC, so let's use it.

Bug: webrtc:12943
Change-Id: I74a0f2fd9c1b9e7b5613ae1c592cf26842b8dddd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228564
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34768}
This commit is contained in:
Victor Boivie
2021-08-12 15:43:13 +02:00
committed by WebRTC LUCI CQ
parent 8df32eb0e1
commit 600bb8c79f
5 changed files with 20 additions and 11 deletions

View File

@ -39,6 +39,7 @@ rtc_library("heartbeat_handler") {
"heartbeat_handler.h", "heartbeat_handler.h",
] ]
absl_deps = [ absl_deps = [
"//third_party/abseil-cpp/absl/functional:bind_front",
"//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional", "//third_party/abseil-cpp/absl/types:optional",
] ]
@ -69,6 +70,7 @@ rtc_library("stream_reset_handler") {
"stream_reset_handler.h", "stream_reset_handler.h",
] ]
absl_deps = [ absl_deps = [
"//third_party/abseil-cpp/absl/functional:bind_front",
"//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional", "//third_party/abseil-cpp/absl/types:optional",
] ]
@ -102,6 +104,7 @@ rtc_library("transmission_control_block") {
"transmission_control_block.h", "transmission_control_block.h",
] ]
absl_deps = [ absl_deps = [
"//third_party/abseil-cpp/absl/functional:bind_front",
"//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional", "//third_party/abseil-cpp/absl/types:optional",
] ]
@ -147,6 +150,7 @@ rtc_library("dcsctp_socket") {
"state_cookie.h", "state_cookie.h",
] ]
absl_deps = [ absl_deps = [
"//third_party/abseil-cpp/absl/functional:bind_front",
"//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional", "//third_party/abseil-cpp/absl/types:optional",
] ]

View File

@ -17,6 +17,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/functional/bind_front.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "absl/types/optional.h" #include "absl/types/optional.h"
@ -151,19 +152,19 @@ DcSctpSocket::DcSctpSocket(absl::string_view log_prefix,
timer_manager_([this]() { return callbacks_.CreateTimeout(); }), timer_manager_([this]() { return callbacks_.CreateTimeout(); }),
t1_init_(timer_manager_.CreateTimer( t1_init_(timer_manager_.CreateTimer(
"t1-init", "t1-init",
[this]() { return OnInitTimerExpiry(); }, absl::bind_front(&DcSctpSocket::OnInitTimerExpiry, this),
TimerOptions(options.t1_init_timeout, TimerOptions(options.t1_init_timeout,
TimerBackoffAlgorithm::kExponential, TimerBackoffAlgorithm::kExponential,
options.max_init_retransmits))), options.max_init_retransmits))),
t1_cookie_(timer_manager_.CreateTimer( t1_cookie_(timer_manager_.CreateTimer(
"t1-cookie", "t1-cookie",
[this]() { return OnCookieTimerExpiry(); }, absl::bind_front(&DcSctpSocket::OnCookieTimerExpiry, this),
TimerOptions(options.t1_cookie_timeout, TimerOptions(options.t1_cookie_timeout,
TimerBackoffAlgorithm::kExponential, TimerBackoffAlgorithm::kExponential,
options.max_init_retransmits))), options.max_init_retransmits))),
t2_shutdown_(timer_manager_.CreateTimer( t2_shutdown_(timer_manager_.CreateTimer(
"t2-shutdown", "t2-shutdown",
[this]() { return OnShutdownTimerExpiry(); }, absl::bind_front(&DcSctpSocket::OnShutdownTimerExpiry, this),
TimerOptions(options.t2_shutdown_timeout, TimerOptions(options.t2_shutdown_timeout,
TimerBackoffAlgorithm::kExponential, TimerBackoffAlgorithm::kExponential,
options.max_retransmissions))), options.max_retransmissions))),
@ -1109,7 +1110,7 @@ void DcSctpSocket::HandleInitAck(
connect_params_.initial_tsn, chunk->initiate_tag(), chunk->initial_tsn(), connect_params_.initial_tsn, chunk->initiate_tag(), chunk->initial_tsn(),
chunk->a_rwnd(), MakeTieTag(callbacks_), chunk->a_rwnd(), MakeTieTag(callbacks_),
[this]() { return state_ == State::kEstablished; }, [this]() { return state_ == State::kEstablished; },
[this](SctpPacket::Builder& builder) { return SendPacket(builder); }); absl::bind_front(&DcSctpSocket::SendPacket, this));
RTC_DLOG(LS_VERBOSE) << log_prefix() RTC_DLOG(LS_VERBOSE) << log_prefix()
<< "Created peer TCB: " << tcb_->ToString(); << "Created peer TCB: " << tcb_->ToString();
@ -1171,7 +1172,7 @@ void DcSctpSocket::HandleCookieEcho(
connect_params_.initial_tsn, cookie->initiate_tag(), connect_params_.initial_tsn, cookie->initiate_tag(),
cookie->initial_tsn(), cookie->a_rwnd(), MakeTieTag(callbacks_), cookie->initial_tsn(), cookie->a_rwnd(), MakeTieTag(callbacks_),
[this]() { return state_ == State::kEstablished; }, [this]() { return state_ == State::kEstablished; },
[this](SctpPacket::Builder& builder) { return SendPacket(builder); }); absl::bind_front(&DcSctpSocket::SendPacket, this));
RTC_DLOG(LS_VERBOSE) << log_prefix() RTC_DLOG(LS_VERBOSE) << log_prefix()
<< "Created peer TCB: " << tcb_->ToString(); << "Created peer TCB: " << tcb_->ToString();
} }

View File

@ -17,6 +17,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/functional/bind_front.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "absl/types/optional.h" #include "absl/types/optional.h"
#include "api/array_view.h" #include "api/array_view.h"
@ -95,11 +96,11 @@ HeartbeatHandler::HeartbeatHandler(absl::string_view log_prefix,
options.heartbeat_interval_include_rtt), options.heartbeat_interval_include_rtt),
interval_timer_(timer_manager_->CreateTimer( interval_timer_(timer_manager_->CreateTimer(
"heartbeat-interval", "heartbeat-interval",
[this]() { return OnIntervalTimerExpiry(); }, absl::bind_front(&HeartbeatHandler::OnIntervalTimerExpiry, this),
TimerOptions(interval_duration_, TimerBackoffAlgorithm::kFixed))), TimerOptions(interval_duration_, TimerBackoffAlgorithm::kFixed))),
timeout_timer_(timer_manager_->CreateTimer( timeout_timer_(timer_manager_->CreateTimer(
"heartbeat-timeout", "heartbeat-timeout",
[this]() { return OnTimeoutTimerExpiry(); }, absl::bind_front(&HeartbeatHandler::OnTimeoutTimerExpiry, this),
TimerOptions(options.rto_initial, TimerOptions(options.rto_initial,
TimerBackoffAlgorithm::kExponential, TimerBackoffAlgorithm::kExponential,
/*max_restarts=*/0))) { /*max_restarts=*/0))) {

View File

@ -17,6 +17,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/functional/bind_front.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "absl/types/optional.h" #include "absl/types/optional.h"
#include "api/array_view.h" #include "api/array_view.h"
@ -77,7 +78,7 @@ class StreamResetHandler {
retransmission_queue_(retransmission_queue), retransmission_queue_(retransmission_queue),
reconfig_timer_(timer_manager->CreateTimer( reconfig_timer_(timer_manager->CreateTimer(
"re-config", "re-config",
[this]() { return OnReconfigTimerExpiry(); }, absl::bind_front(&StreamResetHandler::OnReconfigTimerExpiry, this),
TimerOptions(DurationMs(0)))), TimerOptions(DurationMs(0)))),
next_outgoing_req_seq_nbr_(ReconfigRequestSN(*ctx_->my_initial_tsn())), next_outgoing_req_seq_nbr_(ReconfigRequestSN(*ctx_->my_initial_tsn())),
last_processed_req_seq_nbr_( last_processed_req_seq_nbr_(

View File

@ -17,6 +17,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/functional/bind_front.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "net/dcsctp/common/sequence_numbers.h" #include "net/dcsctp/common/sequence_numbers.h"
#include "net/dcsctp/packet/chunk/cookie_echo_chunk.h" #include "net/dcsctp/packet/chunk/cookie_echo_chunk.h"
@ -63,11 +64,12 @@ class TransmissionControlBlock : public Context {
callbacks_(callbacks), callbacks_(callbacks),
t3_rtx_(timer_manager_.CreateTimer( t3_rtx_(timer_manager_.CreateTimer(
"t3-rtx", "t3-rtx",
[this]() { return OnRtxTimerExpiry(); }, absl::bind_front(&TransmissionControlBlock::OnRtxTimerExpiry, this),
TimerOptions(options.rto_initial))), TimerOptions(options.rto_initial))),
delayed_ack_timer_(timer_manager_.CreateTimer( delayed_ack_timer_(timer_manager_.CreateTimer(
"delayed-ack", "delayed-ack",
[this]() { return OnDelayedAckTimerExpiry(); }, absl::bind_front(&TransmissionControlBlock::OnDelayedAckTimerExpiry,
this),
TimerOptions(options.delayed_ack_max_timeout, TimerOptions(options.delayed_ack_max_timeout,
TimerBackoffAlgorithm::kExponential, TimerBackoffAlgorithm::kExponential,
/*max_restarts=*/0))), /*max_restarts=*/0))),
@ -89,7 +91,7 @@ class TransmissionControlBlock : public Context {
my_initial_tsn, my_initial_tsn,
a_rwnd, a_rwnd,
send_queue, send_queue,
[this](DurationMs rtt) { return ObserveRTT(rtt); }, absl::bind_front(&TransmissionControlBlock::ObserveRTT, this),
[this]() { tx_error_counter_.Clear(); }, [this]() { tx_error_counter_.Clear(); },
*t3_rtx_, *t3_rtx_,
options, options,