Add msp debug flag

This commit is contained in:
Jeremy Lakeman 2013-12-20 12:32:47 +10:30
parent f085ffec50
commit 68421db114
3 changed files with 11 additions and 4 deletions

View File

@ -242,6 +242,7 @@ ATOM(bool_t, gateway, 0, boolean,, "")
ATOM(bool_t, keyring, 0, boolean,, "")
ATOM(bool_t, security, 0, boolean,, "")
ATOM(bool_t, mdprequests, 0, boolean,, "")
ATOM(bool_t, msp, 0, boolean,, "")
ATOM(bool_t, radio_link, 0, boolean,, "")
ATOM(bool_t, peers, 0, boolean,, "")
ATOM(bool_t, overlaybuffer, 0, boolean,, "")

View File

@ -2,6 +2,7 @@
#include <assert.h>
#include <inttypes.h>
#include "serval.h"
#include "conf.h"
#include "mdp_client.h"
#include "msp_client.h"
#include "str.h"
@ -136,6 +137,7 @@ static void free_acked_packets(struct msp_window *window, uint16_t seq)
window->rtt = rtt;
if (window->base_rtt > rtt)
window->base_rtt = rtt;
if (config.debug.msp)
DEBUGF("RTT %u, base %u", rtt, window->base_rtt);
}
if (!p)
@ -342,6 +344,7 @@ static int msp_send_packet(struct msp_sock *sock, struct msp_packet *packet)
msp_close_all(sock->mdp_sock);
return -1;
}
if (config.debug.msp)
DEBUGF("Sent packet seq %02x len %zd (acked %02x)", packet->seq, packet->len, sock->rx.next_seq);
sock->tx.last_activity = packet->sent = gettime_ms();
sock->next_ack = packet->sent + 1500;
@ -386,6 +389,7 @@ static int send_ack(struct msp_sock *sock)
msp_close_all(sock->mdp_sock);
return -1;
}
if (config.debug.msp)
DEBUGF("Sent packet (acked %02x)", sock->rx.next_seq);
sock->previous_ack = sock->rx.next_seq;
sock->tx.last_activity = gettime_ms();
@ -574,6 +578,7 @@ static int process_packet(int mdp_sock, struct mdp_header *header, const uint8_t
// process bind response from the daemon
s->header.local = header->local;
s->header.flags &= ~MDP_FLAG_BIND;
if (config.debug.msp)
DEBUGF("Bound to %s:%d", alloca_tohex_sid_t(header->local.sid), header->local.port);
s->next_action = gettime_ms();
if (s->state & MSP_STATE_LISTENING)

View File

@ -34,6 +34,7 @@ configure_servald_server() {
add_servald_interface
executeOk_servald config \
set debug.mdprequests on \
set debug.msp on \
set log.console.level DEBUG \
set log.console.show_time on
}