Add jmi field for packets discarded due to network error
Also included the total packets attempted to send.
BUG=427555
Copied from https://webrtc-codereview.appspot.com/25959004/
R=harryjin@google.com, juberti@webrtc.org
Committed: https://code.google.com/p/webrtc/source/detail?r=7693
Review URL: https://webrtc-codereview.appspot.com/32039004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7713 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/p2p/base/port.cc b/webrtc/p2p/base/port.cc
index d71d6fa..1cda7c1 100644
--- a/webrtc/p2p/base/port.cc
+++ b/webrtc/p2p/base/port.cc
@@ -851,15 +851,28 @@
// Connection
//
-Connection::Connection(Port* port, size_t index,
+Connection::Connection(Port* port,
+ size_t index,
const Candidate& remote_candidate)
- : port_(port), local_candidate_index_(index),
- remote_candidate_(remote_candidate), read_state_(STATE_READ_INIT),
- write_state_(STATE_WRITE_INIT), connected_(true), pruned_(false),
- use_candidate_attr_(false), remote_ice_mode_(ICEMODE_FULL),
- requests_(port->thread()), rtt_(DEFAULT_RTT), last_ping_sent_(0),
- last_ping_received_(0), last_data_received_(0),
- last_ping_response_received_(0), reported_(false), state_(STATE_WAITING) {
+ : port_(port),
+ local_candidate_index_(index),
+ remote_candidate_(remote_candidate),
+ read_state_(STATE_READ_INIT),
+ write_state_(STATE_WRITE_INIT),
+ connected_(true),
+ pruned_(false),
+ use_candidate_attr_(false),
+ remote_ice_mode_(ICEMODE_FULL),
+ requests_(port->thread()),
+ rtt_(DEFAULT_RTT),
+ last_ping_sent_(0),
+ last_ping_received_(0),
+ last_data_received_(0),
+ last_ping_response_received_(0),
+ sent_packets_discarded_(0),
+ sent_packets_total_(0),
+ reported_(false),
+ state_(STATE_WAITING) {
// All of our connections start in WAITING state.
// TODO(mallinath) - Start connections from STATE_FROZEN.
// Wire up to send stun packets
@@ -1348,6 +1361,14 @@
return send_rate_tracker_.total_units();
}
+size_t Connection::sent_discarded_packets() {
+ return sent_packets_discarded_;
+}
+
+size_t Connection::sent_total_packets() {
+ return sent_packets_total_;
+}
+
void Connection::MaybeAddPrflxCandidate(ConnectionRequest* request,
StunMessage* response) {
// RFC 5245
@@ -1423,11 +1444,13 @@
error_ = EWOULDBLOCK;
return SOCKET_ERROR;
}
+ sent_packets_total_++;
int sent = port_->SendTo(data, size, remote_candidate_.address(),
options, true);
if (sent <= 0) {
ASSERT(sent < 0);
error_ = port_->GetError();
+ sent_packets_discarded_++;
} else {
send_rate_tracker_.Update(sent);
}