-
Notifications
You must be signed in to change notification settings - Fork 86
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
Send timeout #1953
Send timeout #1953
Conversation
9987cdd
to
ebe5200
Compare
Implements #1949 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice; only minor code layout and some simplifications suggested.
traceWith muxTracer $ Mx.MuxTraceHandshakeClientError err (diffTime ts_end ts_start) | ||
throwIO err | ||
Right (Right app) -> do | ||
Just (Right (Right app)) -> do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we simplify the Maybe (Either _ (Either _ r))
type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about this idea:
data HandshakeException a =
HandshakeProtocolLimit ProtocolLimitfailure
| HandshakeProtocolError a
| HanshakeTimeout
tryHandshake :: m (Either a r) -> m (Either (HanshakeException a) r)
tryHandshaket = ... withTimeoutSerial ... try ...
The a
in tryHandshake
would be different for client
and server
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A great idea!
The type signature for a tryHanshake
usable by both initiator and responder will look far worse than the Maybe (Either _ (Either _ r))
it is replacing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? Even though HandshakeException a
is polymorphic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried and failed to get around the need for a Maybe (Either _ (Either _ r))
case statement in tryHandshake
which made things far worse.
The updated code works and is more like your initial suggestion.
061fc90
to
2e311bf
Compare
Simplify mux timeout code by taking advantage of that negative timeouts means no timeout.
Use an overall timeout of 10s which covers both send and recv time.
2e311bf
to
785c6c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bors r+ |
No description provided.