@@ -58,9 +58,10 @@ defmodule Tds.Protocol do
5858 mod . close ( sock )
5959 end
6060
61+ @ spec ping ( any ) :: { :ok , any } | { :disconnect , Exception . t , any }
6162 def ping ( state ) do
6263 case send_query ( ~s{ SELECT 'pong' as [msg]} , state ) do
63- { :ok , _ , s } -> { :ok , s }
64+ { :ok , _ , s } -> { :ok , s }
6465 { :error , err , s } -> { :disconnect , err , s }
6566 end
6667 end
@@ -311,7 +312,7 @@ defmodule Tds.Protocol do
311312 case msg_send ( msg , s ) do
312313 :ok ->
313314 { :noreply , % { s | state: :prelogin } }
314- { :error , reason } ->
315+ { :error , reason , s } ->
315316 error ( % Tds.Error { message: "tcp send: #{ reason } " } , s )
316317 end
317318 end
@@ -538,8 +539,8 @@ defmodule Tds.Protocol do
538539 mod . send ( sock , pak )
539540 end )
540541 case msg_recv ( << >> , s ) do
541- { :disconnect , _ , ex } ->
542- { :error , ex }
542+ { :disconnect , _ex , _s } = res ->
543+ res
543544 buffer ->
544545 new_data ( buffer , % { s | state: :executing , pak_header: "" } )
545546 end
@@ -597,8 +598,8 @@ defmodule Tds.Protocol do
597598 end )
598599
599600 case msg_recv ( << >> , s ) do
600- { :disconnect , _ , ex } ->
601- { :error , ex }
601+ { :disconnect , ex , s } ->
602+ { :error , ex , s }
602603 buffer ->
603604 new_data ( buffer , % { s | state: :login } )
604605 end
0 commit comments