OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/dns/dns_transaction.h" | 5 #include "net/dns/dns_transaction.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 base::TimeTicks::Now() - start_time_); | 385 base::TimeTicks::Now() - start_time_); |
386 } | 386 } |
387 return rv; | 387 return rv; |
388 } | 388 } |
389 | 389 |
390 int DoConnectComplete(int rv) { | 390 int DoConnectComplete(int rv) { |
391 DCHECK_NE(ERR_IO_PENDING, rv); | 391 DCHECK_NE(ERR_IO_PENDING, rv); |
392 if (rv < 0) | 392 if (rv < 0) |
393 return rv; | 393 return rv; |
394 | 394 |
395 base::WriteBigEndian<uint16>(length_buffer_->data(), | 395 uint16 query_size = static_cast<uint16>(query_->io_buffer()->size()); |
396 query_->io_buffer()->size()); | 396 if (static_cast<int>(query_size) != query_->io_buffer()->size()) |
| 397 return ERR_FAILED; |
| 398 base::WriteBigEndian<uint16>(length_buffer_->data(), query_size); |
397 buffer_ = | 399 buffer_ = |
398 new DrainableIOBuffer(length_buffer_.get(), length_buffer_->size()); | 400 new DrainableIOBuffer(length_buffer_.get(), length_buffer_->size()); |
399 next_state_ = STATE_SEND_LENGTH; | 401 next_state_ = STATE_SEND_LENGTH; |
400 return OK; | 402 return OK; |
401 } | 403 } |
402 | 404 |
403 int DoSendLength(int rv) { | 405 int DoSendLength(int rv) { |
404 DCHECK_NE(ERR_IO_PENDING, rv); | 406 DCHECK_NE(ERR_IO_PENDING, rv); |
405 if (rv < 0) | 407 if (rv < 0) |
406 return rv; | 408 return rv; |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 } // namespace | 982 } // namespace |
981 | 983 |
982 // static | 984 // static |
983 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( | 985 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( |
984 DnsSession* session) { | 986 DnsSession* session) { |
985 return scoped_ptr<DnsTransactionFactory>( | 987 return scoped_ptr<DnsTransactionFactory>( |
986 new DnsTransactionFactoryImpl(session)); | 988 new DnsTransactionFactoryImpl(session)); |
987 } | 989 } |
988 | 990 |
989 } // namespace net | 991 } // namespace net |
OLD | NEW |