Class: Mnet::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/mnet.rb

Overview

A TCPServer-compatible listener over the reliable UDP transport, so OpenSSL::SSL::SSLServer.new(server, ctx) works unchanged. accept returns a plain IO (the app end of the per-connection bridge), which the SSL layer can wrap directly.

Instance Method Summary collapse

Constructor Details

#initialize(host = "0.0.0.0", port = 0, **opts) ⇒ Server

Returns a new instance of Server.



1120
1121
1122
1123
# File 'lib/mnet.rb', line 1120

def initialize(host = "0.0.0.0", port = 0, **opts)
  @endpoint = Endpoint.new(**opts)
  @endpoint.listen(host, port)
end

Instance Method Details

#accept ⇒ Object



1125
1126
1127
# File 'lib/mnet.rb', line 1125

def accept
  @endpoint.accept.bridge
end

#accept_session ⇒ Object

Raw session (IO-compatible, no socketpair bridge) for the non-TLS path.



1130
1131
1132
# File 'lib/mnet.rb', line 1130

def accept_session
  @endpoint.accept
end

#addr ⇒ Object



1138
1139
1140
# File 'lib/mnet.rb', line 1138

def addr
  @endpoint.local_addr
end

#close ⇒ Object



1134
1135
1136
# File 'lib/mnet.rb', line 1134

def close
  @endpoint.close
end

#endpoint ⇒ Object



1142
1143
1144
# File 'lib/mnet.rb', line 1142

def endpoint
  @endpoint
end