File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ class RTC_CPP_EXPORT Candidate {
36
36
Candidate (string candidate, string mid);
37
37
38
38
void hintMid (string mid);
39
+ void changeAddress (string addr);
40
+ void changeAddress (string addr, uint16_t port);
41
+ void changeAddress (string addr, string service);
39
42
40
43
enum class ResolveMode { Simple, Lookup };
41
44
bool resolve (ResolveMode mode = ResolveMode::Simple);
Original file line number Diff line number Diff line change @@ -140,6 +140,24 @@ void Candidate::hintMid(string mid) {
140
140
mMid .emplace (std::move (mid));
141
141
}
142
142
143
+ void Candidate::changeAddress (string addr) { changeAddress (std::move (addr), mService ); }
144
+
145
+ void Candidate::changeAddress (string addr, uint16_t port) {
146
+ changeAddress (std::move (addr), std::to_string (port));
147
+ }
148
+
149
+ void Candidate::changeAddress (string addr, string service) {
150
+ mNode = std::move (addr);
151
+ mService = std::move (service);
152
+
153
+ mFamily = Family::Unresolved;
154
+ mAddress .clear ();
155
+ mPort = 0 ;
156
+
157
+ if (!resolve (ResolveMode::Simple))
158
+ throw std::invalid_argument (" Invalid candidate address \" " + addr + " :" + service + " \" " );
159
+ }
160
+
143
161
bool Candidate::resolve (ResolveMode mode) {
144
162
PLOG_VERBOSE << " Resolving candidate (mode="
145
163
<< (mode == ResolveMode::Simple ? " simple" : " lookup" ) << " ): " << mNode << ' '
You can’t perform that action at this time.
0 commit comments