Right fd closing order.

master
Karchnu 2020-11-07 02:32:15 +01:00
parent 4d7a7d3742
commit 6d4db9a8ac
1 changed files with 8 additions and 7 deletions

View File

@ -105,24 +105,25 @@ class Relations < Array(Relation)
LibIPC.ipc_del_fd pointer_ctx, r.fd_service
# Close these sockets.
Baguette::Log.debug "Closing both #{r.fd_client} and #{r.fd_service} (ws)"
begin
s = Socket.new r.fd_client, Socket::Family::UNIX, Socket::Type::RAW
s.close
rescue e
Baguette::Log.error "(ignoring) closing the client socket: #{e}"
end
begin
s = Socket.new r.fd_service, Socket::Family::INET, Socket::Type::STREAM
s.close
rescue e
Baguette::Log.error "(ignoring) closing the service socket: #{e}"
end
begin
r.ws.close
Baguette::Log.warning "CLOSING THE WS"
rescue e
Baguette::Log.error "(ignoring) closing the ws: #{e}"
end
# Trying not to close this socket (ws already do that).
#begin
# s = Socket.new r.fd_service, Socket::Family::INET, Socket::Type::STREAM
# s.close
#rescue e
# Baguette::Log.error "(ignoring) closing the service socket: #{e}"
#end
all_fd.select! {|v| v != r.fd_client && v != r.fd_service }
end