diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,18 @@
+## Version 1.2.6 (23 Mar 2014)
+
+- Fixed socket backend endless loop when the server does not close connection
+  properly at the TLS level with the close notify alert.
+- Catch Error_EOF in recvData and return empty data.
+
+## Version 1.2.5 (23 Mar 2014)
+
+- Fixed Server key exchange data being parsed without the correct
+  context, leading to not knowing how to parse the structure.
+  The bug happens on efficient server that happens to send the ServerKeyXchg
+  message together with the ServerHello in the same handshake packet.
+  This trigger parsing of all the messages without having set the pending cipher.
+  Delay parsing, when this happen, until we know what to do with it.
+
 ## Version 1.2.4 (23 Mar 2014)
 
 - Fixed unrecognized name non-fatal alert after client hello.
diff --git a/Network/TLS/Backend.hs b/Network/TLS/Backend.hs
--- a/Network/TLS/Backend.hs
+++ b/Network/TLS/Backend.hs
@@ -50,7 +50,9 @@
               where loop 0    = return []
                     loop left = do
                         r <- Socket.recv sock left
-                        liftM (r:) (loop (left - B.length r))
+                        if B.null r
+                            then return []
+                            else liftM (r:) (loop (left - B.length r))
 
 instance HasBackend Handle where
     initializeBackend handle = hSetBuffering handle NoBuffering
diff --git a/Network/TLS/Core.hs b/Network/TLS/Core.hs
--- a/Network/TLS/Core.hs
+++ b/Network/TLS/Core.hs
@@ -72,9 +72,14 @@
 recvData :: MonadIO m => Context -> m B.ByteString
 recvData ctx = liftIO $ do
     checkValid ctx
-    pkt <- withReadLock ctx $ recvPacket ctx
-    either onError process pkt
-  where onError err@(Error_Protocol (reason,fatal,desc)) =
+    E.catchJust (\Error_EOF -> Just ())
+                doRecv
+                (\() -> return B.empty)
+  where doRecv = do
+            pkt <- withReadLock ctx $ recvPacket ctx
+            either onError process pkt
+
+        onError err@(Error_Protocol (reason,fatal,desc)) =
             terminate err (if fatal then AlertLevel_Fatal else AlertLevel_Warning) desc reason
         onError err =
             terminate err AlertLevel_Fatal InternalError (show err)
diff --git a/tls.cabal b/tls.cabal
--- a/tls.cabal
+++ b/tls.cabal
@@ -1,5 +1,5 @@
 Name:                tls
-Version:             1.2.5
+Version:             1.2.6
 Description:
    Native Haskell TLS and SSL protocol implementation for server and client.
    .
