   end
 
   def terminate(reason, %{ writer_pid: writer } = state) when writer != nil do
-    debug_log ["terminating writer", state]
+#    debug_log ["terminating writer", state]
     send  writer, {:closed, self()}
     receive do
       :closed -> :ok

  end
  defp send_packet({:write_flush, _cmd, _flush?, _who, _mesg} = write_cmd, 
                   %{writer_pid: writer}) when writer != nil do
    debug_log ["send packet", write_cmd]
    send writer, write_cmd
    :ok
  end

    after howlong -> 
        howlong = :infinity
        to_write = byte_size(acc)
#        debug_log ["time flush", to_write]
        if to_write != 0 do
          send_fn.(acc)
          acc = <<>>
