           module_state: module_state,
           buffer: <<>>
         }
-        GenServerErl.enter_loop(__MODULE__, [], state, 0)
+
+        wait_for_data(state)
+        GenServerErl.enter_loop(__MODULE__, [], state)
+
       {:stop, reason} ->
         :ok = ProcLib.init_ack({:error, reason})
     end


    case module.init(socket, transport, module_opts) do
      {:ok, module_state} ->
        state = %TransportSession{
          ref: ref,
          socket: socket,


      {^error, _socket, reason} ->
        handle_socket_error(state, reason)

      _ ->
        do_handle_info(message, state)
