on a conn_init error send connection_err message instead of closing the ws conn (fix #537) (#572)

This commit is contained in:
Vamshi Surabhi 2018-09-29 13:21:49 +05:30 committed by Shahidh K Muhammed
parent c98c88c00c
commit 67ee3fc0f2

View File

@ -262,8 +262,7 @@ onConnInit (L.Logger logger) manager wsConn authMode connParamsM = do
res <- runExceptT $ getUserInfo logger manager headers authMode
case res of
Left e ->
liftIO $ WS.closeConn wsConn $
BL.fromStrict $ TE.encodeUtf8 $ qeError e
sendMsg wsConn $ SMConnErr $ ConnErrMsg $ qeError e
Right userInfo -> do
liftIO $ IORef.writeIORef (_wscUser $ WS.getData wsConn) $ Just userInfo
sendMsg wsConn SMConnAck