anchor.diff:              fail
       end.
   
  +send_bundle_if_ready(InState) ->
  +    QL = msg_queue_len(InState),
  +    case QL of
  +        0 -> InState;
  +        _ ->
  +            State = inc_msgs_since_bundle_start(InState),
  +            DBS = desired_bundle_size(State),
  +            MSBS = msgs_since_bundle_start(State),
  +            case (QL + MSBS) >= DBS of
  +                true ->
  +                    Socket = socket(State),
  +                    %% io:format("Sending packet with ~p msgs~n", [length(msg_queue(State))]),
  +                    NewSocket =
  +                        send({dest_ip(State), dest_port(State), Socket},
  +                             unpack_msg_bundle, msg_queue(State)),
  +                    T1State = set_socket(State, NewSocket),
  +                    T2State = inc_s_msg_count(T1State),
  +                    T3State = set_msg_queue(T2State, []),
  +                    T4State = set_msg_queue_len(T3State, 0),
  +                    _T5State = set_msgs_since_bundle_start(T4State, 0);
  +                false -> State
  +            end
  +    end.
  +
   -spec state_new(DestIP::inet:ip_address(), DestPort::comm_server:tcp_port(),
                   LocalListenPort::comm_server:tcp_port(),
                   Socket::inet:socket() | notconnected) -> state().
  
positive.code: set_msg_queue_len(State, Val) -> setelement(9, State, Val).
  desired_bundle_size(State)    -> element(10, State).
  set_desired_bundle_size(State, Val) -> setelement(10, State, Val).
  
  status(State) ->
       case socket(State) of
  
negative.code:           lists:flatten(io_lib:format("~p", [r_msg_count(State) / Runtime]))}
          ],
      comm:send_local(Requestor, {web_debug_info_reply, KeyValueList}),
      send_bundle_if_ready(State);
  
  on(UnknownMessage, State) ->
      %% we want to count messages, so we need this default handler.
      log:log(error,"unknown message: ~.0p~n in Module: ~p and handler ~p~n in State ~.0p",[UnknownMessage,?MODULE,on,State]),
      send_bundle_if_ready(State).
  
  -spec send({inet:ip_address(), comm_server:tcp_port(), inet:socket()}, pid(), comm:message()) ->
                     notconnected | inet:socket();
  