Skip to content

Commit

Permalink
checking EOF in bye (#261).
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Dec 13, 2017
1 parent a7db8c8 commit f4afb94
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/Network/TLS/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ import Control.Monad.State.Strict
--
-- this doesn't actually close the handle
bye :: MonadIO m => Context -> m ()
bye ctx = sendPacket ctx $ Alert [(AlertLevel_Warning, CloseNotify)]
bye ctx = do
eof <- liftIO $ ctxEOF ctx
unless eof $ sendPacket ctx $ Alert [(AlertLevel_Warning, CloseNotify)]

-- | If the ALPN extensions have been used, this will
-- return get the protocol agreed upon.
Expand Down

0 comments on commit f4afb94

Please sign in to comment.