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.



1146
1147
1148
1149
# File 'lib/mnet.rb', line 1146

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

Instance Method Details

#acceptObject



1151
1152
1153
# File 'lib/mnet.rb', line 1151

def accept
  @endpoint.accept.bridge
end

#accept_sessionObject

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



1156
1157
1158
# File 'lib/mnet.rb', line 1156

def accept_session
  @endpoint.accept
end

#addrObject



1164
1165
1166
# File 'lib/mnet.rb', line 1164

def addr
  @endpoint.local_addr
end

#closeObject



1160
1161
1162
# File 'lib/mnet.rb', line 1160

def close
  @endpoint.close
end

#endpointObject



1168
1169
1170
# File 'lib/mnet.rb', line 1168

def endpoint
  @endpoint
end