Anton Lebedevich 13 лет назад
Родитель
Сommit
8e8f72afc6
2 измененных файлов с 12 добавлено и 3 удалено
  1. 3 2
      src/pgsql.erl
  2. 9 1
      src/pgsql_sock.erl

+ 3 - 2
src/pgsql.erl

@@ -109,10 +109,11 @@ describe(C, Type, Name) ->
     pgsql_sock:describe(C, Type, Name).
 
 close(C, #statement{name = Name}) ->
-    pgsql_sock:close(C, statement, Name).
+    close(C, statement, Name).
 
 close(C, Type, Name) ->
-    pgsql_sock:close(C, Type, Name).
+    Ref = pgsql_sock:close(C, Type, Name),
+    receive_atom(C, Ref, ok, ok).
 
 sync(C) ->
     Ref = pgsql_sock:sync(C),

+ 9 - 1
src/pgsql_sock.erl

@@ -398,7 +398,15 @@ on_message({$2, <<>>}, State) ->
 
 %% CloseComplete
 on_message({$3, <<>>}, State) ->
-    {noreply, State};
+    #state{queue = Q} = State,
+    State2 = case request_tag(State) of
+                 C when C == close ->
+                     notify(State, ok),
+                     State#state{queue = queue:drop(Q)};
+                 _ ->
+                     State
+             end,
+    {noreply, State2};
 
 %% DataRow
 on_message({$D, <<_Count:?int16, Bin/binary>>}, State) ->