| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 // winsock2.h must be included first in order to ensure it is included before | 8 // winsock2.h must be included first in order to ensure it is included before |
| 9 // windows.h. | 9 // windows.h. |
| 10 #include <winsock2.h> | 10 #include <winsock2.h> |
| 11 #elif defined(OS_POSIX) | 11 #elif defined(OS_POSIX) |
| 12 #include <errno.h> | 12 #include <errno.h> |
| 13 #include <sys/socket.h> | 13 #include <sys/socket.h> |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #if defined(USE_SYSTEM_LIBEVENT) |
| 17 #include <event.h> |
| 18 #else |
| 16 #include "third_party/libevent/event.h" | 19 #include "third_party/libevent/event.h" |
| 20 #endif |
| 17 #include "base/message_pump_libevent.h" | 21 #include "base/message_pump_libevent.h" |
| 18 #endif | 22 #endif |
| 19 | 23 |
| 20 #include "base/eintr_wrapper.h" | 24 #include "base/eintr_wrapper.h" |
| 21 #include "net/base/telnet_server.h" | 25 #include "net/base/telnet_server.h" |
| 22 | 26 |
| 23 #if defined(OS_POSIX) | 27 #if defined(OS_POSIX) |
| 24 // Used same name as in Windows to avoid #ifdef where refrenced | 28 // Used same name as in Windows to avoid #ifdef where refrenced |
| 25 #define SOCKET int | 29 #define SOCKET int |
| 26 const int INVALID_SOCKET = -1; | 30 const int INVALID_SOCKET = -1; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } else { | 272 } else { |
| 269 const char *data = buf; | 273 const char *data = buf; |
| 270 for (int i = 0; i < len; ++i) { | 274 for (int i = 0; i < len; ++i) { |
| 271 unsigned char c = static_cast<unsigned char>(*data); | 275 unsigned char c = static_cast<unsigned char>(*data); |
| 272 StateMachineStep(c); | 276 StateMachineStep(c); |
| 273 data++; | 277 data++; |
| 274 } | 278 } |
| 275 } | 279 } |
| 276 } while (len == kReadBufSize); | 280 } while (len == kReadBufSize); |
| 277 } | 281 } |
| OLD | NEW |