| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2008 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 // SSL_write uses the same arguments (though, with | 558 // SSL_write uses the same arguments (though, with |
| 559 // SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER, the actual buffer pointer may be | 559 // SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER, the actual buffer pointer may be |
| 560 // different). | 560 // different). |
| 561 // | 561 // |
| 562 // However, after Send exits, we will have lost access to data the user of | 562 // However, after Send exits, we will have lost access to data the user of |
| 563 // this class is trying to send, and there's no guarantee that the user of | 563 // this class is trying to send, and there's no guarantee that the user of |
| 564 // this class will call Send with the same arguements when it fails. So, we | 564 // this class will call Send with the same arguements when it fails. So, we |
| 565 // buffer the data ourselves. When we know the underlying socket is writable | 565 // buffer the data ourselves. When we know the underlying socket is writable |
| 566 // again from OnWriteEvent (or if Send is called again before that happens), | 566 // again from OnWriteEvent (or if Send is called again before that happens), |
| 567 // we'll retry sending this buffered data. | 567 // we'll retry sending this buffered data. |
| 568 if ((error == SSL_ERROR_WANT_READ || error == SSL_ERROR_WANT_WRITE) && | 568 if (error == SSL_ERROR_WANT_READ || error == SSL_ERROR_WANT_WRITE) { |
| 569 pending_data_.empty()) { | 569 // Shouldn't be able to get to this point if we already have pending data. |
| 570 RTC_DCHECK(pending_data_.empty()); |
| 570 LOG(LS_WARNING) | 571 LOG(LS_WARNING) |
| 571 << "SSL_write couldn't write to the underlying socket; buffering data."; | 572 << "SSL_write couldn't write to the underlying socket; buffering data."; |
| 572 pending_data_.SetData(static_cast<const uint8_t*>(pv), cb); | 573 pending_data_.SetData(static_cast<const uint8_t*>(pv), cb); |
| 573 // Since we're taking responsibility for sending this data, return its full | 574 // Since we're taking responsibility for sending this data, return its full |
| 574 // size. The user of this class can consider it sent. | 575 // size. The user of this class can consider it sent. |
| 575 return cb; | 576 return cb; |
| 576 } | 577 } |
| 577 | 578 |
| 578 return ret; | 579 return ret; |
| 579 } | 580 } |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 SSL_CTX_set_cipher_list(ctx, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); | 1000 SSL_CTX_set_cipher_list(ctx, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); |
| 1000 | 1001 |
| 1001 if (ssl_mode_ == SSL_MODE_DTLS) { | 1002 if (ssl_mode_ == SSL_MODE_DTLS) { |
| 1002 SSL_CTX_set_read_ahead(ctx, 1); | 1003 SSL_CTX_set_read_ahead(ctx, 1); |
| 1003 } | 1004 } |
| 1004 | 1005 |
| 1005 return ctx; | 1006 return ctx; |
| 1006 } | 1007 } |
| 1007 | 1008 |
| 1008 } // namespace rtc | 1009 } // namespace rtc |
| OLD | NEW |