Sha256: 7fa271032749a6c88b9027db2b760994cd856d2aaf9b8f4e91f3c8862a2b737e

Contents?: true

Size: 451 Bytes

Versions: 9

Compression:

Stored size: 451 Bytes

Contents

# patch TCPSocket to make operations synchrony
class TCPSocket
  alias _orig_initialize initialize

  def initialize *xs
    _orig_initialize *xs
    Nyara::Ext.set_nonblock fileno
    Nyara::Ext.fd_watch fileno
  end

  def send data, flags, dest_addr=nil, &blk
    if dest_addr
      super
    else
      Nyara::Ext.fd_send fileno, data, flags, &blk
    end
  end

  def recv max_len, flags=0
    Nyara::Ext.fd_recv fileno, max_len, flags
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nyara-0.1.pre.2 lib/nyara/patches/tcp_socket.rb
nyara-0.1.pre.1 lib/nyara/patches/tcp_socket.rb
nyara-0.1.pre.0 lib/nyara/patches/tcp_socket.rb
nyara-0.0.1.pre.9 lib/nyara/patches/tcp_socket.rb
nyara-0.0.1.pre.8 lib/nyara/patches/tcp_socket.rb
nyara-0.0.1.pre.6 lib/nyara/patches/tcp_socket.rb
nyara-0.0.1.pre.5 lib/nyara/patches/tcp_socket.rb
nyara-0.0.1.pre.4 lib/nyara/patches/tcp_socket.rb
nyara-0.0.1.pre.3 lib/nyara/patch_tcp_socket.rb