Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing the case where sent == 0 (#320) #321

Merged
merged 3 commits into from
May 29, 2018

Conversation

kazu-yamamoto
Copy link
Collaborator

This fixes #320.

@kazu-yamamoto kazu-yamamoto requested review from eborden and Mistuke May 25, 2018 05:50
Copy link
Collaborator

@Mistuke Mistuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

@Mistuke
Copy link
Collaborator

Mistuke commented May 25, 2018

although threadWaitWrite requires -threaded on Windows. Which I think wasn't a requirement before for network right? Not sure what a proper solution for the non-threaded case would be.

As a side note, I am currently almost done implementing a new I/O manager for Windows, which will land within the next two GHC releases. This moves everything to IOCP, at that time I will need to submit network patches for those bits.

The fd interface will still be available for a while though.

@kazu-yamamoto
Copy link
Collaborator Author

although threadWaitWrite requires -threaded on Windows. Which I think wasn't a requirement before for network right? Not sure what a proper solution for the non-threaded case would be.

Is threadWaitWrite harmful for non-threaded RTS on Windows?
If not, I would merge this PR as is.

@Mistuke
Copy link
Collaborator

Mistuke commented May 28, 2018

Yes, on the non-threaded RTS it's a hard error https://hackage.haskell.org/package/base-4.7.0.0/docs/src/Control-Concurrent.html#threadWaitWrite, so you wouldn't be able to use network anymore with the non-threaded rts.

@kazu-yamamoto
Copy link
Collaborator Author

@Mistuke I pushed one commit. Would you review this PR again.

Copy link
Collaborator

@Mistuke Mistuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the import of c_writev on Windows breaks the build, looks like you don't need it anyway so removing it should do.

other than that the changes look good.

import qualified Data.ByteString as S
import qualified Data.ByteString.Lazy as L
import Data.Int (Int64)

import Network.Socket (Socket(..))
import qualified Network.Socket.ByteString as Socket
import Network.Socket.ByteString.Internal (c_writev, waitWhen0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c_writev doesn't exists for Windows.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. And done.

Copy link
Collaborator

@Mistuke Mistuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

kazu-yamamoto added a commit to kazu-yamamoto/network that referenced this pull request May 29, 2018
@kazu-yamamoto kazu-yamamoto merged commit 3de0e8c into haskell:2.7 May 29, 2018
@kazu-yamamoto kazu-yamamoto deleted the sendall branch May 29, 2018 00:58
@kazu-yamamoto
Copy link
Collaborator Author

Merged. Thanks!

@jaspervdj
Copy link
Member

I think this change caused jaspervdj/websockets#180, I'll see if I can put together a small test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants