2362N/A * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. 893N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 893N/A * This code is free software; you can redistribute it and/or modify it 893N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 893N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 893N/A * This code is distributed in the hope that it will be useful, but WITHOUT 893N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 893N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 893N/A * version 2 for more details (a copy is included in the LICENSE file that 893N/A * accompanied this code). 893N/A * You should have received a copy of the GNU General Public License version 893N/A * 2 along with this work; if not, write to the Free Software Foundation, 893N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 893N/A * Windows implementation of AsynchronousServerSocketChannel using overlapped I/O. 893N/A // 2 * (sizeof(SOCKET_ADDRESS) + 16) 893N/A // typically there will be zero, or one I/O operations pending. In rare 893N/A // cases there may be more. These rare cases arise when a sequence of accept 893N/A // operations complete immediately and handled by the initiating thread. 893N/A // event has been posted. 893N/A // flag to indicate that an accept operation is outstanding 893N/A // associate socket with given completion port 893N/A // close socket (which may cause outstanding accept to be aborted). 893N/A // waits until the accept operations have completed 893N/A // finally disassociate from the completion port 893N/A // release other resources 893N/A * Task to initiate accept operation and to handle result. 893N/A // caller must have acquired read lock for the listener and child channel. 893N/A * in that it requires 2 calls to getsockname and 2 calls to getpeername. 893N/A * (should change this to use GetAcceptExSockaddrs) 893N/A // permission check (in context of initiating thread) 893N/A * Initiates the accept operation. 893N/A // begin usage of listener socket 893N/A // begin usage of child socket (as it is registered with 893N/A // completion port and so may be closed in the event that 893N/A // the group is forcefully closed). 893N/A // connection accepted immediately 893N/A // allow another accept before the result is set 893N/A // end usage on child socket 893N/A // failed to initiate accept so release resources 893N/A // end of usage of listener socket 893N/A // accept completed immediately but may not have executed on 893N/A // initiating thread in which case the operation may have been 893N/A // invoke completion handler 893N/A * Executed when the I/O has completed 893N/A // connection accept after group has shutdown 893N/A // allow another accept before the result is set 893N/A // if an async cancel has already cancelled the operation then 893N/A // close the new channel so as to free resources 893N/A // invoke handler (but not directly) 893N/A // ensure channel is bound to local address 893N/A // create the socket that will be accepted. The creation of the socket 893N/A // is enclosed by a begin/end for the listener socket to ensure that 893N/A // we check that the listener is open and also to prevent the I/O 893N/A // port from being closed as the new socket is registered. 893N/A // need calling context when there is security manager as 893N/A // permission check may be done in a different thread without 893N/A // any application call frames on the stack 893N/A // check and set flag to prevent concurrent accepting 893N/A // -- Native methods --