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 "cloud_print/gcp20/prototype/dns_sd_server.h" | 5 #include "cloud_print/gcp20/prototype/dns_sd_server.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/big_endian.h" | |
tfarina
2014/02/26 02:54:24
note to myself: remove, unused?
tfarina
2014/02/26 02:54:24
Done.
| |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
14 #include "cloud_print/gcp20/prototype/dns_packet_parser.h" | 15 #include "cloud_print/gcp20/prototype/dns_packet_parser.h" |
15 #include "cloud_print/gcp20/prototype/dns_response_builder.h" | 16 #include "cloud_print/gcp20/prototype/dns_response_builder.h" |
16 #include "net/base/big_endian.h" | |
17 #include "net/base/dns_util.h" | 17 #include "net/base/dns_util.h" |
18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
19 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
20 #include "net/dns/dns_protocol.h" | 20 #include "net/dns/dns_protocol.h" |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 const char kDefaultIpAddressMulticast[] = "224.0.0.251"; | 24 const char kDefaultIpAddressMulticast[] = "224.0.0.251"; |
25 const uint16 kDefaultPortMulticast = 5353; | 25 const uint16 kDefaultPortMulticast = 5353; |
26 | 26 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 | 318 |
319 uint32 DnsSdServer::GetCurrentTLL() const { | 319 uint32 DnsSdServer::GetCurrentTLL() const { |
320 uint32 current_ttl = (time_until_live_ - base::Time::Now()).InSeconds(); | 320 uint32 current_ttl = (time_until_live_ - base::Time::Now()).InSeconds(); |
321 if (time_until_live_ < base::Time::Now() || current_ttl == 0) { | 321 if (time_until_live_ < base::Time::Now() || current_ttl == 0) { |
322 // This should not be reachable. But still we don't need to fail. | 322 // This should not be reachable. But still we don't need to fail. |
323 current_ttl = 1; // Service is still alive. | 323 current_ttl = 1; // Service is still alive. |
324 LOG(ERROR) << "|current_ttl| was equal to zero."; | 324 LOG(ERROR) << "|current_ttl| was equal to zero."; |
325 } | 325 } |
326 return current_ttl; | 326 return current_ttl; |
327 } | 327 } |
OLD | NEW |