You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have checked that there is no existing PR/issue about my proposal.
Motivation
Currently, using the linear network API, you can close the same socket many times. This could be a problem because a new socket could be created with the same descriptor and we could affect how it works.
The program below will output "Error 2: errno 9" from the problem described. Return code 9 means "Bad file descriptor". This error occurs when using a socket that is already closed.
Сhange close function and all functions returning Socket Closed
The result will be a similar API as in the article Linear Haskell and ATS.
Alternatives considered
You can impose a constraint on the state of the socket in the close function as in this Haskell library. This fixes the problem, but it's more complicated and makes less sense since there's hardly any use for a closed socket handle.
The text was updated successfully, but these errors were encountered:
Motivation
Currently, using the linear network API, you can close the same socket many times. This could be a problem because a new socket could be created with the same descriptor and we could affect how it works.
The program below will output "Error 2: errno 9" from the problem described. Return code 9 means "Bad file descriptor". This error occurs when using a socket that is already closed.
The proposal
In
Control.Linear.Network
:Closed
statedone
functionclose
function and all functions returningSocket Closed
The result will be a similar API as in the article Linear Haskell and ATS.
Alternatives considered
You can impose a constraint on the state of the socket in the
close
function as in this Haskell library. This fixes the problem, but it's more complicated and makes less sense since there's hardly any use for a closed socket handle.The text was updated successfully, but these errors were encountered: