network icon indicating copy to clipboard operation
network copied to clipboard

What should I write instead of `isBound`?

Open kindaro opened this issue 1 year ago • 3 comments

The package krpc is not building. One of the issues is that the function isActive:

https://github.com/pxqr/krpc/blob/5c54f6570a27e1509ddf048a91bd69c05052f2f1/src/Network/KRPC/Manager.hs#L195-L201

— Wants to call isBound but I see from the change log that it was deprecated in 2.7 and removed in 3.0, along with other stuff related to SocketStatus.

I did not find any migration guide or the reasoning behind it being removed.

Is there a standard way to fix the function isBound?

kindaro avatar May 11 '24 07:05 kindaro

Otherwise, could you release an updated version 2 that can be built with GHC 9.4 or thereabout? The latest as of now is 2.8.0.1 and it needs base < 4.17 which is kinda close. Some versions of network-2 build with GHC 9.4 and the Cabal flag --allow-newer=base already so maybe it is only a matter of metadata revision.

kindaro avatar May 11 '24 07:05 kindaro

Socket does not have the status anymore.

Probably you can check if a socket is bound using getSocketName. The initial port is 0. After binding, the port should be the server port.

When the socket is closed, the internal FD value becomes -1. You can check it with withFdSocket.

kazu-yamamoto avatar May 14 '24 00:05 kazu-yamamoto

Thank you, I shall try this.

kindaro avatar May 14 '24 18:05 kindaro

Closing. Please re-open if necessary.

kazu-yamamoto avatar Nov 07 '24 00:11 kazu-yamamoto