anchor.diff:  -export([init/1, code_change/3, terminate/2]).
   
   %% state callbacks
  --export([auth/2, initializing/2, on_message/2]).
  +-export([auth/2, initializing/2, on_message/2, on_replication/2]).
   
   -include("epgsql.hrl").
   -include("epgsql_binary.hrl").
  
positive.code:     {reply, {ok, Status}, State};
  
  handle_call({standby_status_update, FlushedLSN, AppliedLSN}, _From,
      #state{repl_last_received_lsn = ReceivedLSN} = State) ->
      send(State, ?COPY_DATA, epgsql_wire:encode_standby_status_update(ReceivedLSN, FlushedLSN, AppliedLSN)),
      {reply, ok, State#state{repl_last_flushed_lsn = FlushedLSN, repl_last_applied_lsn = AppliedLSN}};
  
  handle_call(Command, From, State) ->
      #state{queue = Q} = State,
  
negative.code:             PluginOpts -> [Sql1 , " (", PluginOpts, ")"]
          end,
  
      Repl2 =
          case Callback of
              Pid when is_pid(Pid) -> Repl#repl{receiver = Pid};
              Module -> Repl#repl{cbmodule = Module, cbstate = CbInitState}
          end,
  
      Hex = [H || H <- WALPosition, H =/= $/],
      {ok, [LSN], _} = io_lib:fread("~16u", Hex),
  
      State2 = State#state{repl = Repl2#repl{last_flushed_lsn = LSN,
                                             last_applied_lsn = LSN},
                           handler = on_replication},
  
      send(State2, ?SIMPLEQUERY, [Sql2, 0]),
      {noreply, State2}.
  
  start_ssl(S, Flag, Opts, State) ->
      ok = gen_tcp:send(S, <<8:?int32, 80877103:?int32>>),
  