| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_BASE_VIRTUALSOCKETSERVER_H_ | 11 #ifndef WEBRTC_BASE_VIRTUALSOCKETSERVER_H_ |
| 12 #define WEBRTC_BASE_VIRTUALSOCKETSERVER_H_ | 12 #define WEBRTC_BASE_VIRTUALSOCKETSERVER_H_ |
| 13 | 13 |
| 14 #include <assert.h> | |
| 15 | |
| 16 #include <deque> | 14 #include <deque> |
| 17 #include <map> | 15 #include <map> |
| 18 | 16 |
| 17 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/base/constructormagic.h" | 18 #include "webrtc/base/constructormagic.h" |
| 20 #include "webrtc/base/messagequeue.h" | 19 #include "webrtc/base/messagequeue.h" |
| 21 #include "webrtc/base/socketserver.h" | 20 #include "webrtc/base/socketserver.h" |
| 22 | 21 |
| 23 namespace rtc { | 22 namespace rtc { |
| 24 | 23 |
| 25 class Packet; | 24 class Packet; |
| 26 class VirtualSocket; | 25 class VirtualSocket; |
| 27 class SocketAddressPair; | 26 class SocketAddressPair; |
| 28 | 27 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 78 } |
| 80 | 79 |
| 81 // If the (transit) delay parameters are modified, this method should be | 80 // If the (transit) delay parameters are modified, this method should be |
| 82 // called to recompute the new distribution. | 81 // called to recompute the new distribution. |
| 83 void UpdateDelayDistribution(); | 82 void UpdateDelayDistribution(); |
| 84 | 83 |
| 85 // Controls the (uniform) probability that any sent packet is dropped. This | 84 // Controls the (uniform) probability that any sent packet is dropped. This |
| 86 // is separate from calculations to drop based on queue size. | 85 // is separate from calculations to drop based on queue size. |
| 87 double drop_probability() { return drop_prob_; } | 86 double drop_probability() { return drop_prob_; } |
| 88 void set_drop_probability(double drop_prob) { | 87 void set_drop_probability(double drop_prob) { |
| 89 assert((0 <= drop_prob) && (drop_prob <= 1)); | 88 RTC_DCHECK_GE(drop_prob, 0.0); |
| 89 RTC_DCHECK_LE(drop_prob, 1.0); |
| 90 drop_prob_ = drop_prob; | 90 drop_prob_ = drop_prob; |
| 91 } | 91 } |
| 92 | 92 |
| 93 // If |blocked| is true, subsequent attempts to send will result in -1 being | 93 // If |blocked| is true, subsequent attempts to send will result in -1 being |
| 94 // returned, with the socket error set to EWOULDBLOCK. | 94 // returned, with the socket error set to EWOULDBLOCK. |
| 95 // | 95 // |
| 96 // If this method is later called with |blocked| set to false, any sockets | 96 // If this method is later called with |blocked| set to false, any sockets |
| 97 // that previously failed to send with EWOULDBLOCK will emit SignalWriteEvent. | 97 // that previously failed to send with EWOULDBLOCK will emit SignalWriteEvent. |
| 98 // | 98 // |
| 99 // This can be used to simulate the send buffer on a network interface being | 99 // This can be used to simulate the send buffer on a network interface being |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 375 |
| 376 // Store the options that are set | 376 // Store the options that are set |
| 377 OptionsMap options_map_; | 377 OptionsMap options_map_; |
| 378 | 378 |
| 379 friend class VirtualSocketServer; | 379 friend class VirtualSocketServer; |
| 380 }; | 380 }; |
| 381 | 381 |
| 382 } // namespace rtc | 382 } // namespace rtc |
| 383 | 383 |
| 384 #endif // WEBRTC_BASE_VIRTUALSOCKETSERVER_H_ | 384 #endif // WEBRTC_BASE_VIRTUALSOCKETSERVER_H_ |
| OLD | NEW |