| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/local_discovery/privet_traffic_detector.h" | 5 #include "chrome/browser/local_discovery/privet_traffic_detector.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/sys_byteorder.h" | 8 #include "base/sys_byteorder.h" |
| 9 #include "net/base/dns_util.h" | 9 #include "net/base/dns_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (IsPrivetPacket(rv)) { | 171 if (IsPrivetPacket(rv)) { |
| 172 socket_.reset(); | 172 socket_.reset(); |
| 173 callback_runner_->PostTask(FROM_HERE, on_traffic_detected_); | 173 callback_runner_->PostTask(FROM_HERE, on_traffic_detected_); |
| 174 base::TimeDelta time_delta = base::Time::Now() - start_time_; | 174 base::TimeDelta time_delta = base::Time::Now() - start_time_; |
| 175 UMA_HISTOGRAM_LONG_TIMES("LocalDiscovery.DetectorTriggerTime", | 175 UMA_HISTOGRAM_LONG_TIMES("LocalDiscovery.DetectorTriggerTime", |
| 176 time_delta); | 176 time_delta); |
| 177 return net::OK; | 177 return net::OK; |
| 178 } | 178 } |
| 179 | 179 |
| 180 rv = socket_->RecvFrom( | 180 rv = socket_->RecvFrom( |
| 181 io_buffer_, | 181 io_buffer_.get(), |
| 182 io_buffer_->size(), | 182 io_buffer_->size(), |
| 183 &recv_addr_, | 183 &recv_addr_, |
| 184 base::Bind(base::IgnoreResult(&PrivetTrafficDetector::DoLoop), | 184 base::Bind(base::IgnoreResult(&PrivetTrafficDetector::DoLoop), |
| 185 base::Unretained(this))); | 185 base::Unretained(this))); |
| 186 } while (rv > 0); | 186 } while (rv > 0); |
| 187 | 187 |
| 188 if (rv != net::ERR_IO_PENDING) | 188 if (rv != net::ERR_IO_PENDING) |
| 189 return rv; | 189 return rv; |
| 190 | 190 |
| 191 return net::OK; | 191 return net::OK; |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace local_discovery | 194 } // namespace local_discovery |
| OLD | NEW |