@Override public Socket accept() throws IOException { UnixSocketChannel channel = serverSocketChannel.accept(); return new BlockingUnixSocket(path, channel, endpoint); }
public UnixSocket accept() throws IOException { return new UnixSocket(channel.accept()); }
public UnixSocket accept() throws IOException { return new UnixSocket(channel.accept()); }
public final void process(SelectionKey key) throws IOException { try { UnixSocketChannel clientChannel = channel.accept(); clientChannel.configureBlocking(false); clientChannel.register(selector, SelectionKey.OP_READ, new SshAgentSessionSocketHandler(clientChannel)); } catch (IOException ex) { LOGGER.log(Level.WARNING, "failed to accept new connection", ex); safelyClose(channel); throw ex; } } }
public final boolean rxready() { try { UnixSocketChannel client = channel.accept(); client.configureBlocking(false); client.register(selector, SelectionKey.OP_READ, new ClientActor(client)); return true; } catch (IOException ex) { return false; } } }
@Override protected SelectableChannel doAccept(SelectableChannel server) throws IOException { if (LOG.isDebugEnabled()) LOG.debug("doAccept async {}",server); UnixSocketChannel channel = ((UnixServerSocketChannel)server).accept(); if (LOG.isDebugEnabled()) LOG.debug("accepted async {}",channel); return channel; } }
final UnixSocketChannel c = channel.accept(); System.out.println("Accepted"); final QueueItem qi = queue.take();
@Override public void accept(int acceptorID) throws IOException { LOG.debug("Blocking UnixSocket accept used. Might not be able to be interrupted!"); UnixServerSocketChannel serverChannel = _acceptChannel; if (serverChannel != null && serverChannel.isOpen()) { LOG.debug("accept {}",serverChannel); UnixSocketChannel channel = serverChannel.accept(); LOG.debug("accepted {}",channel); accepted(channel); } }
@JRubyMethod public IRubyObject accept_nonblock(ThreadContext context) { Ruby runtime = context.runtime; SelectableChannel selectable = (SelectableChannel)channel; synchronized (selectable.blockingLock()) { boolean oldBlocking = selectable.isBlocking(); try { selectable.configureBlocking(false); try { UnixSocketChannel socketChannel = ((UnixServerSocketChannel) channel).accept(); RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate")); sock.channel = socketChannel; sock.fpath = ""; sock.init_sock(context.runtime); return sock; } finally { selectable.configureBlocking(oldBlocking); } } catch (IOException ioe) { if (ioe.getMessage().equals("accept failed: Resource temporarily unavailable")) { if (runtime.is1_9()) { throw runtime.newErrnoEAGAINReadableError("accept"); } else { throw runtime.newErrnoEAGAINError("accept"); } } throw context.runtime.newIOErrorFromException(ioe); } } }
@JRubyMethod public IRubyObject accept_nonblock(ThreadContext context) { Ruby runtime = context.runtime; SelectableChannel selectable = (SelectableChannel)channel; synchronized (selectable.blockingLock()) { boolean oldBlocking = selectable.isBlocking(); try { selectable.configureBlocking(false); try { UnixSocketChannel socketChannel = ((UnixServerSocketChannel) channel).accept(); RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate")); sock.channel = socketChannel; sock.fpath = ""; sock.init_sock(context.runtime); return sock; } finally { selectable.configureBlocking(oldBlocking); } } catch (IOException ioe) { if (ioe.getMessage().equals("accept failed: Resource temporarily unavailable")) { if (runtime.is1_9()) { throw runtime.newErrnoEAGAINReadableError("accept"); } else { throw runtime.newErrnoEAGAINError("accept"); } } throw context.runtime.newIOErrorFromException(ioe); } } }
public IRubyObject accept_nonblock(ThreadContext context, Ruby runtime, boolean ex) { SelectableChannel selectable = (SelectableChannel)getChannel(); synchronized (selectable.blockingLock()) { boolean oldBlocking = selectable.isBlocking(); try { selectable.configureBlocking(false); try { UnixSocketChannel socketChannel = ((UnixServerSocketChannel) selectable).accept(); if (socketChannel == null) { if (!ex) return runtime.newSymbol("wait_readable"); throw runtime.newErrnoEAGAINReadableError("accept(2) would block"); } RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate")); sock.init_sock(context.runtime, socketChannel, ""); return sock; } finally { selectable.configureBlocking(oldBlocking); } } catch (IOException ioe) { if (ioe.getMessage().equals("accept failed: Resource temporarily unavailable")) { if (!ex) return runtime.newSymbol("wait_readable"); throw runtime.newErrnoEAGAINReadableError("accept"); } throw context.runtime.newIOErrorFromException(ioe); } } }
public IRubyObject accept_nonblock(ThreadContext context, Ruby runtime, boolean ex) { SelectableChannel selectable = (SelectableChannel)getChannel(); synchronized (selectable.blockingLock()) { boolean oldBlocking = selectable.isBlocking(); try { selectable.configureBlocking(false); try { UnixSocketChannel socketChannel = ((UnixServerSocketChannel) selectable).accept(); if (socketChannel == null) { if (!ex) return runtime.newSymbol("wait_readable"); throw runtime.newErrnoEAGAINReadableError("accept(2) would block"); } RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate")); sock.init_sock(context.runtime, socketChannel, ""); return sock; } finally { selectable.configureBlocking(oldBlocking); } } catch (IOException ioe) { if (ioe.getMessage().equals("accept failed: Resource temporarily unavailable")) { if (!ex) return runtime.newSymbol("wait_readable"); throw runtime.newErrnoEAGAINReadableError("accept"); } throw context.runtime.newIOErrorFromException(ioe); } } }
@JRubyMethod public IRubyObject accept(ThreadContext context) { Ruby runtime = context.runtime; try { while (true) { // select loop to allow interrupting boolean ready = context.getThread().select(this, SelectionKey.OP_ACCEPT); if (!ready) { // we were woken up without being selected...poll for thread events and go back to sleep context.pollThreadEvents(); } else { UnixSocketChannel socketChannel = asUnixServer().accept(); RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate")); sock.channel = socketChannel; sock.fpath = ""; sock.init_sock(context.runtime); return sock; } } } catch (IOException ioe) { throw context.runtime.newIOErrorFromException(ioe); } }
@JRubyMethod public IRubyObject accept(ThreadContext context) { Ruby runtime = context.runtime; try { while (true) { // select loop to allow interrupting boolean ready = context.getThread().select(this, SelectionKey.OP_ACCEPT); if (!ready) { // we were woken up without being selected...poll for thread events and go back to sleep context.pollThreadEvents(); } else { UnixSocketChannel socketChannel = asUnixServer().accept(); RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate")); sock.channel = socketChannel; sock.fpath = ""; sock.init_sock(context.runtime); return sock; } } } catch (IOException ioe) { throw context.runtime.newIOErrorFromException(ioe); } }
@JRubyMethod public IRubyObject accept(ThreadContext context) { Ruby runtime = context.runtime; try { while (true) { // select loop to allow interrupting boolean ready = context.getThread().select(this, SelectionKey.OP_ACCEPT); if (!ready) { // we were woken up without being selected...poll for thread events and go back to sleep context.pollThreadEvents(); } else { UnixSocketChannel socketChannel = asUnixServer().accept(); RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate")); sock.init_sock(context.runtime, socketChannel, ""); return sock; } } } catch (IOException ioe) { throw context.runtime.newIOErrorFromException(ioe); } }
@JRubyMethod public IRubyObject accept(ThreadContext context) { Ruby runtime = context.runtime; try { while (true) { // select loop to allow interrupting boolean ready = context.getThread().select(this, SelectionKey.OP_ACCEPT); if (!ready) { // we were woken up without being selected...poll for thread events and go back to sleep context.pollThreadEvents(); } else { UnixSocketChannel socketChannel = asUnixServer().accept(); RubyUNIXSocket sock = (RubyUNIXSocket)(Helpers.invoke(context, runtime.getClass("UNIXSocket"), "allocate")); sock.init_sock(context.runtime, socketChannel, ""); return sock; } } } catch (IOException ioe) { throw context.runtime.newIOErrorFromException(ioe); } }