@JRubyMethod() public IRubyObject connect(ThreadContext context, IRubyObject arg) { SocketAddress addr = addressForChannel(context, arg); return doConnect(context, addr, true); }
@JRubyMethod() public IRubyObject connect(ThreadContext context, IRubyObject arg) { SocketAddress addr = addressForChannel(context, arg); return doConnect(context, addr, true); }
@JRubyMethod() public IRubyObject connect(ThreadContext context, IRubyObject arg) { SocketAddress addr = addressForChannel(context, arg); doConnect(context, getChannel(), addr); return RubyFixnum.zero(context.runtime); }
@JRubyMethod() public IRubyObject connect(ThreadContext context, IRubyObject arg) { SocketAddress addr = addressForChannel(context, arg); doConnect(context, getChannel(), addr); return RubyFixnum.zero(context.runtime); }
private void doConnectNonblock(ThreadContext context, Channel channel, SocketAddress addr) { if (!(channel instanceof SelectableChannel)) { throw getRuntime().newErrnoENOPROTOOPTError(); } SelectableChannel selectable = (SelectableChannel)channel; synchronized (selectable.blockingLock()) { boolean oldBlocking = selectable.isBlocking(); try { selectable.configureBlocking(false); try { doConnect(context, channel, addr); } finally { selectable.configureBlocking(oldBlocking); } } catch(ClosedChannelException e) { throw context.runtime.newErrnoECONNREFUSEDError(); } catch(IOException e) { throw SocketUtils.sockerr(context.runtime, "connect(2): name or service not known"); } } }
private void doConnectNonblock(ThreadContext context, Channel channel, SocketAddress addr) { if (!(channel instanceof SelectableChannel)) { throw getRuntime().newErrnoENOPROTOOPTError(); } SelectableChannel selectable = (SelectableChannel)channel; synchronized (selectable.blockingLock()) { boolean oldBlocking = selectable.isBlocking(); try { selectable.configureBlocking(false); try { doConnect(context, channel, addr); } finally { selectable.configureBlocking(oldBlocking); } } catch(ClosedChannelException e) { throw context.runtime.newErrnoECONNREFUSEDError(); } catch(IOException e) { throw SocketUtils.sockerr(context.runtime, "connect(2): name or service not known"); } } }
private IRubyObject doConnectNonblock(ThreadContext context, SocketAddress addr, boolean ex) { Channel channel = getChannel(); if ( ! (channel instanceof SelectableChannel) ) { throw context.runtime.newErrnoENOPROTOOPTError(); } SelectableChannel selectable = (SelectableChannel) channel; synchronized (selectable.blockingLock()) { boolean oldBlocking = selectable.isBlocking(); try { selectable.configureBlocking(false); try { return doConnect(context, addr, ex); } finally { selectable.configureBlocking(oldBlocking); } } catch (ClosedChannelException e) { throw context.runtime.newErrnoECONNREFUSEDError(); } catch (IOException e) { throw sockerr(context.runtime, "connect(2): name or service not known", e); } } }
private IRubyObject doConnectNonblock(ThreadContext context, SocketAddress addr, boolean ex) { Channel channel = getChannel(); if ( ! (channel instanceof SelectableChannel) ) { throw context.runtime.newErrnoENOPROTOOPTError(); } SelectableChannel selectable = (SelectableChannel) channel; synchronized (selectable.blockingLock()) { boolean oldBlocking = selectable.isBlocking(); try { selectable.configureBlocking(false); try { return doConnect(context, addr, ex); } finally { selectable.configureBlocking(oldBlocking); } } catch (ClosedChannelException e) { throw context.runtime.newErrnoECONNREFUSEDError(); } catch (IOException e) { throw sockerr(context.runtime, "connect(2): name or service not known", e); } } }