Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 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/socket/ssl_client_socket_mac.h" | 5 #include "net/socket/ssl_client_socket_mac.h" |
| 6 | 6 |
| 7 #include "base/singleton.h" | 7 #include "base/singleton.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 } | 709 } |
| 710 | 710 |
| 711 if (rv == ERR_IO_PENDING) { | 711 if (rv == ERR_IO_PENDING) { |
| 712 us->next_io_state_ = STATE_READ_COMPLETE; | 712 us->next_io_state_ = STATE_READ_COMPLETE; |
| 713 } else { | 713 } else { |
| 714 us->read_io_buf_ = NULL; | 714 us->read_io_buf_ = NULL; |
| 715 } | 715 } |
| 716 | 716 |
| 717 if (rv < 0) | 717 if (rv < 0) |
| 718 return OSStatusFromNetError(rv); | 718 return OSStatusFromNetError(rv); |
| 719 | 719 else if (rv == 0) // stream closed |
|
John Grabowski
2009/07/15 22:39:54
Shouldn't this be (rv == OK) to be consistent with
Avi (use Gerrit)
2009/07/15 22:47:08
The docs say "zero" is returned for end-of-stream
wtc
2009/07/16 00:22:50
Yes, Read() returns a byte count or error code, so
| |
| 720 return noErr; | 720 return errSSLClosedGraceful; |
| 721 else | |
| 722 return noErr; | |
| 721 } | 723 } |
| 722 | 724 |
| 723 // static | 725 // static |
| 724 OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection, | 726 OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection, |
| 725 const void* data, | 727 const void* data, |
| 726 size_t* data_length) { | 728 size_t* data_length) { |
| 727 SSLClientSocketMac* us = | 729 SSLClientSocketMac* us = |
| 728 const_cast<SSLClientSocketMac*>( | 730 const_cast<SSLClientSocketMac*>( |
| 729 static_cast<const SSLClientSocketMac*>(connection)); | 731 static_cast<const SSLClientSocketMac*>(connection)); |
| 730 | 732 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 753 | 755 |
| 754 if (rv < 0 && rv != ERR_IO_PENDING) { | 756 if (rv < 0 && rv != ERR_IO_PENDING) { |
| 755 return OSStatusFromNetError(rv); | 757 return OSStatusFromNetError(rv); |
| 756 } | 758 } |
| 757 | 759 |
| 758 // always lie to our caller | 760 // always lie to our caller |
| 759 return noErr; | 761 return noErr; |
| 760 } | 762 } |
| 761 | 763 |
| 762 } // namespace net | 764 } // namespace net |
| OLD | NEW |