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/jingle_glue/xmpp_socket_adapter.h" | 5 #include "remoting/jingle_glue/xmpp_socket_adapter.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 FreeState(); | 43 FreeState(); |
44 | 44 |
45 // Clean up any previous socket - cannot delete socket on close because close | 45 // Clean up any previous socket - cannot delete socket on close because close |
46 // happens during the child socket's stack callback. | 46 // happens during the child socket's stack callback. |
47 if (socket_) { | 47 if (socket_) { |
48 delete socket_; | 48 delete socket_; |
49 socket_ = NULL; | 49 socket_ = NULL; |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
| 53 buzz::AsyncSocket::State XmppSocketAdapter::state() { |
| 54 return state_; |
| 55 } |
| 56 |
| 57 buzz::AsyncSocket::Error XmppSocketAdapter::error() { |
| 58 return error_; |
| 59 } |
| 60 |
| 61 int XmppSocketAdapter::GetError() { |
| 62 return wsa_error_; |
| 63 } |
| 64 |
53 bool XmppSocketAdapter::FreeState() { | 65 bool XmppSocketAdapter::FreeState() { |
54 int code = 0; | 66 int code = 0; |
55 | 67 |
56 // Clean up the socket. | 68 // Clean up the socket. |
57 if (socket_ && !(state_ == STATE_CLOSED || state_ == STATE_CLOSING)) { | 69 if (socket_ && !(state_ == STATE_CLOSED || state_ == STATE_CLOSING)) { |
58 code = socket_->Close(); | 70 code = socket_->Close(); |
59 } | 71 } |
60 | 72 |
61 delete[] write_buffer_; | 73 delete[] write_buffer_; |
62 write_buffer_ = NULL; | 74 write_buffer_ = NULL; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 int wsa_error = 0; | 431 int wsa_error = 0; |
420 FlushWriteQueue(&error, &wsa_error); | 432 FlushWriteQueue(&error, &wsa_error); |
421 if (error != ERROR_NONE) { | 433 if (error != ERROR_NONE) { |
422 Close(); | 434 Close(); |
423 return false; | 435 return false; |
424 } | 436 } |
425 return true; | 437 return true; |
426 } | 438 } |
427 | 439 |
428 } // namespace remoting | 440 } // namespace remoting |
OLD | NEW |