OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "remoting/protocol/message_reader.h" | 5 #include "remoting/protocol/message_reader.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/socket/socket.h" | 10 #include "net/socket/socket.h" |
11 #include "remoting/base/compound_buffer.h" | 11 #include "remoting/base/compound_buffer.h" |
12 #include "remoting/proto/internal.pb.h" | 12 #include "remoting/proto/internal.pb.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
| 15 namespace protocol { |
15 | 16 |
16 static const int kReadBufferSize = 4096; | 17 static const int kReadBufferSize = 4096; |
17 | 18 |
18 MessageReader::MessageReader() | 19 MessageReader::MessageReader() |
19 : socket_(NULL), | 20 : socket_(NULL), |
20 closed_(false), | 21 closed_(false), |
21 ALLOW_THIS_IN_INITIALIZER_LIST( | 22 ALLOW_THIS_IN_INITIALIZER_LIST( |
22 read_callback_(this, &MessageReader::OnRead)) { | 23 read_callback_(this, &MessageReader::OnRead)) { |
23 } | 24 } |
24 | 25 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 59 |
59 void MessageReader::HandleReadResult(int result) { | 60 void MessageReader::HandleReadResult(int result) { |
60 if (result > 0) { | 61 if (result > 0) { |
61 data_received_callback_->Run(read_buffer_, result); | 62 data_received_callback_->Run(read_buffer_, result); |
62 } else { | 63 } else { |
63 if (result != net::ERR_IO_PENDING) | 64 if (result != net::ERR_IO_PENDING) |
64 LOG(ERROR) << "Read() returned error " << result; | 65 LOG(ERROR) << "Read() returned error " << result; |
65 } | 66 } |
66 } | 67 } |
67 | 68 |
| 69 } // namespace protocol |
68 } // namespace remoting | 70 } // namespace remoting |
OLD | NEW |