Skip to content

Add path to UNIXSocket created by UNIXServer#5869

Merged
RX14 merged 1 commit intocrystal-lang:masterfrom
straight-shoota:jm/fix/unix-server-path
Apr 13, 2018
Merged

Add path to UNIXSocket created by UNIXServer#5869
RX14 merged 1 commit intocrystal-lang:masterfrom
straight-shoota:jm/fix/unix-server-path

Conversation

@straight-shoota
Copy link
Copy Markdown
Member

A UNIXServer creates an instance of UNIXSocket for every incoming socket connection but unlike client sockets, the values for local_address and remote_address were missing. This PR adds them.

UNIXServer.open(path) do |server|
  server.local_address.path     # => path

  UNIXSocket.open(path) do |client|
    client.local_address.path   # => path
    client.remote_address.path  # => path

    server.accept do |sock|
      sock.local_address.path   # => path (previously "")
      sock.remote_address.path  # => path (previously "")
    end
  end
end

There were specs to explicitly check that local_address and remote_address on a server UNIXSocket would be "" but I don't think there is any reason for this and they should in fact return the path the server listens to.

@sdogruyol sdogruyol added topic:stdlib kind:bug A bug in the code. Does not apply to documentation, specs, etc. labels Apr 13, 2018
@RX14 RX14 added this to the Next milestone Apr 13, 2018
@RX14 RX14 merged commit 9376982 into crystal-lang:master Apr 13, 2018
@straight-shoota straight-shoota deleted the jm/fix/unix-server-path branch April 13, 2018 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants