Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/curvecp/messenger.h" | 5 #include "net/curvecp/messenger.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 | 271 |
| 272 void Messenger::RecvMessage() { | 272 void Messenger::RecvMessage() { |
| 273 if (!read_queue_.size()) | 273 if (!read_queue_.size()) |
| 274 return; | 274 return; |
| 275 | 275 |
| 276 scoped_refptr<IOBufferWithSize> message(read_queue_.front()); | 276 scoped_refptr<IOBufferWithSize> message(read_queue_.front()); |
| 277 read_queue_.pop_front(); | 277 read_queue_.pop_front(); |
| 278 | 278 |
| 279 Message* header = reinterpret_cast<Message*>(message->data()); | 279 Message* header = reinterpret_cast<Message*>(message->data()); |
| 280 uint16 body_length = uint16_unpack(header->size.val); | 280 uint16 body_length = uint16_unpack(header->size.val); |
| 281 if (body_length < 0) | 281 if (body_length < 0) |
|
Peter Mayo
2011/05/18 18:30:44
Checking to see if an unsigned int is less than ze
willchan no longer on Chromium
2011/05/18 19:23:22
Hah, yes, this looks like a bug :) Mike should fix
| |
| 282 return; | 282 return; |
| 283 if (body_length > kMaxMessageLength) | 283 if (body_length > kMaxMessageLength) |
| 284 return; | 284 return; |
| 285 if (body_length > message->size()) | 285 if (body_length > message->size()) |
| 286 return; | 286 return; |
| 287 | 287 |
| 288 uint32 message_id = uint32_unpack(header->message_id); | 288 uint32 message_id = uint32_unpack(header->message_id); |
| 289 if (message_id) { | 289 if (message_id) { |
| 290 LOG(ERROR) << "RecvMessage Message id: " << message_id | 290 LOG(ERROR) << "RecvMessage Message id: " << message_id |
| 291 << ", " << body_length << " bytes"; | 291 << ", " << body_length << " bytes"; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 | 363 |
| 364 int rv = packetizer_->SendMessage(key_, | 364 int rv = packetizer_->SendMessage(key_, |
| 365 buffer->data(), | 365 buffer->data(), |
| 366 sizeof(Message), | 366 sizeof(Message), |
| 367 &send_message_callback_); | 367 &send_message_callback_); |
| 368 // TODO(mbelshe): Fix me! Deal with the error cases | 368 // TODO(mbelshe): Fix me! Deal with the error cases |
| 369 DCHECK(rv == sizeof(Message)); | 369 DCHECK(rv == sizeof(Message)); |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace net | 372 } // namespace net |
| OLD | NEW |