Class: Nonnative::SocketPair
- Inherits:
-
Object
- Object
- Nonnative::SocketPair
show all
- Defined in:
- lib/nonnative/socket_pair.rb
Instance Method Summary
collapse
Constructor Details
#initialize(proxy) ⇒ SocketPair
5
6
7
|
# File 'lib/nonnative/socket_pair.rb', line 5
def initialize(proxy)
@proxy = proxy
end
|
Instance Method Details
#connect(local_socket) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/nonnative/socket_pair.rb', line 9
def connect(local_socket)
remote_socket = create_remote_socket
loop do
ready = select([local_socket, remote_socket], nil, nil)
break if pipe(ready, local_socket, remote_socket)
break if pipe(ready, remote_socket, local_socket)
end
ensure
local_socket.close
remote_socket&.close
end
|