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.



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

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

Instance Method Details

#accept ⇒ Object



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

def accept
  @endpoint.accept.bridge
end

#accept_session ⇒ Object

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



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

def accept_session
  @endpoint.accept
end

#addr ⇒ Object



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

def addr
  @endpoint.local_addr
end

#close ⇒ Object



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

def close
  @endpoint.close
end

#endpoint ⇒ Object



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

def endpoint
  @endpoint
end