2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * Common adr_stream implementation 2N/A * File descriptor stream implementation. 2N/A * SSL stream implementation 2N/A * Neither documentation nor internet chatter is clear on whether it is 2N/A * legal to call SSL_write after an SSL_read that returns 2N/A * SSL_ERROR_WANT_* before completing the SSL_read (and vice versa), 2N/A * but I don't see how the interfaces are otherwise usable without 2N/A * introducing cross-connection deadlocks. 2N/A * To avoid the single-side deadlock situation where one thread reads 2N/A * socket data between when the other drops its lock and starts to poll 2N/A * for it, we call poll with a 5 second timeout. This limits the time 2N/A * spent polling (in the traditional sense) the socket, and lets us to 2N/A * check every once in a while in case this rare situation arises, all 2N/A * without the per-connection overhead more precise solutions require. 2N/A * Poll for the ability to do so, and retry. 2N/A * Use a timeout in case a renegotiation caused another 2N/A * Much simpler than implementing a precise wakeup.