Commit graph

31 commits

Author SHA1 Message Date
Florent Castelli
8037fc6ffa Migrate absl::optional to std::optional
Bug: webrtc:342905193
No-Try: True
Change-Id: Icc968be43b8830038ea9a1f5f604307220457807
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361021
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42911}
2024-09-02 12:16:47 +00:00
Harald Alvestrand
24510d43dc Delete deprecated AsyncResolver and related classes
To be submitted after downstream usage has been removed, but no earlier than December 1, 2023.

Bug: webrtc:12598
Change-Id: Id9acbac591c48c0c5883fe8f06cf6a68471b70f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/323004
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41290}
2023-11-30 15:36:55 +00:00
Danil Chapovalov
babdaa8623 Unbind VirtualSocket from rtc::MessageHandler
Instead protect pending tasks with a shared object.
Some tests destroy VirtualSocket on a different thread than it is used on,
Some tests destroy VirtualSocket together with VirtualSocketServer after
associated thread is deleted, thus complicated check is used to ensure
VirtualSockets are safe to use.

Bug: webrtc:9702
Change-Id: I1a19cd24ac6a598a1cde64434104cad0b750096e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274460
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38103}
2022-09-16 14:13:41 +00:00
Markus Handell
9a21c49337 SocketServer: Migrate Wait/kForever to TimeDelta.
Bug: webrtc:13756
Change-Id: Ie36ca38b1ab336742231b101ef7bb5ccf3735659
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272102
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37903}
2022-08-25 13:01:34 +00:00
Danil Chapovalov
207f8536b2 In rtc::Thread hide MessageHandler handling as implementation details
Remote Peek function as unused
Move Get and Dispatch into private section to ensure they are not used
from outside.

Bug: webrtc:9702
Change-Id: Ibd0b236fe43543d60f97f988524526493bbeaaa7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272804
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37889}
2022-08-24 13:40:09 +00:00
Markus Handell
2cfc1af78a Update rtc::Event::Wait call sites to use TimeDelta.
Bug: webrtc:14366
Change-Id: I949c1d26f030696b18153afef977633c9a5bd4cf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272003
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37835}
2022-08-19 10:07:28 +00:00
Tommi
ccc9d979a5 Add checks for a null msg_queue_ to VirtualSocketServer.
The Thread class internally (`Thread::DoDestroy`) makes this call:
  ss_->SetMessageQueue(nullptr);

Which sets the `msg_queue_` member variable of VirtualSocketServer
to nullptr. VSS checks for this in several places, but not all. In
particular `CancelConnects()` does handle it, but Disconnect(), which
is called from the same place (VirtualSocket::Close()), is missing
this check.

This CL adds some DCHECKs to catch when a pointer might be nullptr
and also avoids dereferencing a potential nullptr deref during teardown
if `Disconnect` is called, e.g. from within `VirtualSocket::Close()`
which is called from the dtor of `VirtualSocket`.

Bug: webrtc:13864
Change-Id: I717a0f033ebf70b1f59338680957723a77ccf4ca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256600
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36312}
2022-03-24 08:18:43 +00:00
Florent Castelli
f94c053814 VSS: Fix TSAN error related to internal variables
The VSS is used in tests, usually from the signaling thread, but all the
network emulation happens in the network thread. TSAN will then complain
about variable access from different threads without any synchronization.

Bug: b/204654931
Change-Id: I164f5d73e559f00e6bf390ef5e5f112bcc58ce11
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237784
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35357}
2021-11-16 15:05:05 +00:00
Artem Titov
d3251968d1 Prepare to rename RTC_NOTREACHED to RTC_DCHECK_NOTREACHED
Add implementation of RTC_DCHECK_NOTREACHED equal to the RTC_NOTREACHED.
The new macros will replace the old one when old one's usage will be
removed. The idea of the renaming to provide a clear signal that this
is debug build only macros and will be stripped in the production build.

Bug: webrtc:9065
Change-Id: I4c35d8b03e74a4b3fd1ae75dba2f9c05643101db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237802
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35348}
2021-11-15 21:44:59 +00:00
Mirko Bonadei
54c90f2330 [-Wshadow] - Fix some warnings.
First CL to try to understand the extent of the cleanup needed in
order to remove -Wno-shadow and follow Chromium on enabling this
diagnostic.

Bug: webrtc:13219
Change-Id: Ie699762da50fe3dbc08b1fd92220962d4b7da86b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/233641
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35134}
2021-10-03 11:53:16 +00:00
Niels Möller
84d1595d01 Rename VirtualSocketServer::SetDefaultRoute --> SetDefaultSourceAddress
and make docs a bit clearer.

Bug: None
Change-Id: I73504de96384012d18c00c527835fabab03a3791
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230544
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34895}
2021-09-01 14:27:29 +00:00
Niels Möller
c2d8f1e6bc Extract method VirtualSocketServer::AssignBindAddress
Bug: webrtc:13065
Change-Id: Ib8ec14dd193457c010ba6ed943c73cc237bf8bae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229982
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34845}
2021-08-25 08:39:52 +00:00
Niels Möller
ea423a5b8d Delete leftovers of synchronous code path in VirtualSocketServer
Followup to https://webrtc-review.googlesource.com/c/src/+/227031.

Bug: webrtc:13065
Change-Id: Ifa8943e81bd90c19807d2fc55768201c915726d8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229185
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34815}
2021-08-20 11:41:13 +00:00
Niels Möller
d0b8879770 Delete AsyncSocket class, merge into Socket class
Bug: webrtc:13065
Change-Id: I13afee2386ea9c4de0e4fa95133f0c4d3ec826e8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227031
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34787}
2021-08-17 15:39:25 +00:00
Artem Titov
96e3b991da Use backticks not vertical bars to denote variables in comments for /rtc_base
Bug: webrtc:12338
Change-Id: I72fcb505a92f03b2ace7160ee33d555a977eddfd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226955
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34587}
2021-07-28 13:51:47 +00:00
Niels Möller
c413c5581b Replace use of RecursiveCriticalSection in VirtualSocketServer
Also change listen_queue_ member to use std::unique_ptr to
manage ownership.

Bug: webrtc:11567
Change-Id: I85171c9cd0253fdbcbce38b1cfebb1adb5bddd9b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/223063
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34353}
2021-06-22 09:02:56 +00:00
Niels Möller
257f81b98e Update VirtualSocketServer locking to match documentation.
Add GUARDED_BY annotation on members claimed to be protected by the
lock, and add missing lock operations. Also mark a few members const.

Bug: webrtc:11567, webrtc:2079
Change-Id: I8f12ca7627df0c24e07fa2ae24a387c6a0ed76cf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208224
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34340}
2021-06-21 07:47:49 +00:00
Niels Möller
9bd2457857 Delete SignalQueueDestroyed
It was used only to break the circular dependency between SocketServer
and Thread at destruction time. Replaced with a method call to
SetMessageQueue(nullptr).

Bug: webrtc:11943
Change-Id: I0606d473ad79655cca28411bb02c21e21d2d7220
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215587
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33807}
2021-04-22 13:04:53 +00:00
Harald Alvestrand
3d792e990a Add controls for MTU size of virtual socket server
This will allow us to write tests for what happens when large datagrams
are discarded.

Bug: webrtc:12495
Change-Id: I5c8e9fe55917967ea4604e1b3abe3c590c330ffa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211044
Reviewed-by: Taylor <deadbeef@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33425}
2021-03-10 20:06:22 +00:00
Niels Möller
d44532afb7 Delete unused sigslot SignalAddressReady and MSG_ID_ADDRESS_BOUND
Followup to https://webrtc-review.googlesource.com/c/src/+/207181

Bug: webrtc:11567
Change-Id: I604232eda0d5df7d9fe070926a37a4496924c637
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208280
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33317}
2021-02-22 14:19:36 +00:00
Niels Möller
c79bd433a1 Delete friendship between VirtualSocket and VirtualSocketServer
Bug: webrtc:11567
Change-Id: I07d01b9eed798a69ba798e899b2bae57409ce332
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/207181
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33276}
2021-02-16 09:10:16 +00:00
Niels Möller
983627c88d Update VirtualSocketServer to use more std::unique_ptr
And delete RecursiveCriticalSection delay_crit_.

Bug: webrtc:11567
Change-Id: I70826fba3806e5d7525d6288be3d83eb43cc5fe6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206469
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33228}
2021-02-11 09:17:23 +00:00
Tomas Gunnarsson
d96634781e Remove dependency on MessageHandlerAutoCleanup from VirtualSocket
Bug: webrtc:11988
Change-Id: Ifeb901b110bd6c82922ae2560e4d508c6ed289d2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/194560
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32661}
2020-11-22 11:34:04 +00:00
Markus Handell
3cb525b378 Rename CriticalSection to RecursiveCriticalSection.
This name change communicates that the recursive critical section
should not be used for new code.
The relevant files are renamed rtc_base/critical_section* ->
rtc_base/deprecated/recursive_critical_section*

Bug: webrtc:11567
Change-Id: I73483a1c5e59c389407a981efbfc2cfe76ccdb43
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179483
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31754}
2020-07-17 09:19:50 +00:00
Markus Handell
18523c34b4 Migrate rtc_base to webrtc::Mutex.
Bug: webrtc:11567
Change-Id: Ib8630e0cf1266e7c3f8ce718e1ed9f8848f42ec8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178806
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31682}
2020-07-08 20:38:54 +00:00
Danil Chapovalov
0c626afcf3 Use newer version of TimeDelta and TimeStamp factories in webrtc
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Micros<\(.*\)>()/TimeDelta::Micros(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Millis<\(.*\)>()/TimeDelta::Millis(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Seconds<\(.*\)>()/TimeDelta::Seconds(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::us/TimeDelta::Micros/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::ms/TimeDelta::Millis/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::seconds/TimeDelta::Seconds/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Micros<\(.*\)>()/Timestamp::Micros(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Millis<\(.*\)>()/Timestamp::Millis(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Seconds<\(.*\)>()/Timestamp::Seconds(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::us/Timestamp::Micros/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::ms/Timestamp::Millis/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::seconds/Timestamp::Seconds/g"
git cl format

Bug: None
Change-Id: I87469d2e4a38369654da839ab7c838215a7911e7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168402
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30491}
2020-02-10 12:21:17 +00:00
Sebastian Jansson
290de82b2a Cleanup: Replace MessageQueue pointers with Thread pointers.
This is part of a CL series merging rtc::MessageQueue into rtc::Thread.

Bug: webrtc:9883
Change-Id: I4a1bcd44c9523b6402b3f05b50597bdc2e6615e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165345
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30216}
2020-01-10 19:03:12 +00:00
Sebastian Jansson
d624c3903c Make MessageQueue processing an optional feature of FakeClock
This is used to avoid thread processing in simulated time
controller. This saves up to 30% execution time in debug builds.

Bug: webrtc:10365
Change-Id: Ie83dfb2468d371e4687d28c776acf7e23eb411d1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133173
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27666}
2019-04-17 14:10:16 +00:00
Steve Anton
2acd163448 Use Abseil container algorithms in rtc_base/
Bug: None
Change-Id: I4499adaf8e777d570a3bc119ee29727ab7c790a5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128962
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27271}
2019-03-25 22:08:06 +00:00
Steve Anton
10542f21c8 (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries
Mechanically generated by running this command:

tools_webrtc/do-renames.sh update all-renames.txt && git cl format

Then manually updating:

tools_webrtc/sanitizers/tsan_suppressions_webrtc.cc

Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I54824cd91dada8fc3ee3d098f971bc319d477833
Reviewed-on: https://webrtc-review.googlesource.com/c/115653
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26226}
2019-01-11 17:11:39 +00:00
Steve Anton
1c05765831 (3) Rename files to snake_case: move the files
Mechanically generated with this command:

tools_webrtc/do-rename.sh move all-renames.txt

Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I8b05b6eab9b9d18b29c2199bbea239e9add1e690
Reviewed-on: https://webrtc-review.googlesource.com/c/115481
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26225}
2019-01-11 17:05:20 +00:00
Renamed from rtc_base/virtualsocketserver.cc (Browse further)