bugfix: control messages were lost due to lack of buffers; wait for buffer before sending
This commit is contained in:
parent
076c208b72
commit
10064dbdd9
1 changed files with 26 additions and 10 deletions
|
@ -450,7 +450,7 @@ recv_ctrl(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
|
|||
const static struct runicast_callbacks runicast_callbacks =
|
||||
{ recv_ctrl, sent_ctrl, timedout_ctrl };
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
static int
|
||||
send_ctrl_command(const rimeaddr_t *to, uint8_t command)
|
||||
{
|
||||
struct ctrl_msg *msg;
|
||||
|
@ -458,7 +458,7 @@ send_ctrl_command(const rimeaddr_t *to, uint8_t command)
|
|||
packetbuf_set_datalen(sizeof(struct ctrl_msg));
|
||||
msg = packetbuf_dataptr();
|
||||
msg->command = command;
|
||||
runicast_send(&ctrl, to, MAX_RETRIES);
|
||||
return runicast_send(&ctrl, to, MAX_RETRIES);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
|
@ -589,7 +589,9 @@ PROCESS_THREAD(shell_netperf_process, ev, data)
|
|||
shell_output_str(&netperf_command, "-------- Broadcast --------", "");
|
||||
|
||||
shell_output_str(&netperf_command, "Contacting ", recvstr);
|
||||
send_ctrl_command(&receiver, CTRL_COMMAND_CLEAR);
|
||||
while(!send_ctrl_command(&receiver, CTRL_COMMAND_CLEAR)) {
|
||||
PROCESS_PAUSE();
|
||||
}
|
||||
PROCESS_YIELD_UNTIL(ev == CONTINUE_EVENT);
|
||||
|
||||
shell_output_str(&netperf_command, "Measuring broadcast performance to ", recvstr);
|
||||
|
@ -604,7 +606,9 @@ PROCESS_THREAD(shell_netperf_process, ev, data)
|
|||
}
|
||||
|
||||
shell_output_str(&netperf_command, "Requesting statistics from ", recvstr);
|
||||
send_ctrl_command(&receiver, CTRL_COMMAND_STATS);
|
||||
while(!send_ctrl_command(&receiver, CTRL_COMMAND_STATS)) {
|
||||
PROCESS_PAUSE();
|
||||
}
|
||||
PROCESS_YIELD_UNTIL(ev == CONTINUE_EVENT);
|
||||
|
||||
/* Wait for reply */
|
||||
|
@ -619,7 +623,9 @@ PROCESS_THREAD(shell_netperf_process, ev, data)
|
|||
shell_output_str(&netperf_command, "-------- Unicast one-way --------", "");
|
||||
|
||||
shell_output_str(&netperf_command, "Contacting ", recvstr);
|
||||
send_ctrl_command(&receiver, CTRL_COMMAND_CLEAR);
|
||||
while(!send_ctrl_command(&receiver, CTRL_COMMAND_CLEAR)) {
|
||||
PROCESS_PAUSE();
|
||||
}
|
||||
PROCESS_YIELD_UNTIL(ev == CONTINUE_EVENT);
|
||||
|
||||
shell_output_str(&netperf_command, "Measuring unicast performance to ", recvstr);
|
||||
|
@ -635,7 +641,9 @@ PROCESS_THREAD(shell_netperf_process, ev, data)
|
|||
}
|
||||
|
||||
shell_output_str(&netperf_command, "Requesting statistics from ", recvstr);
|
||||
send_ctrl_command(&receiver, CTRL_COMMAND_STATS);
|
||||
while(!send_ctrl_command(&receiver, CTRL_COMMAND_STATS)) {
|
||||
PROCESS_PAUSE();
|
||||
}
|
||||
PROCESS_YIELD_UNTIL(ev == CONTINUE_EVENT);
|
||||
|
||||
/* Wait for reply */
|
||||
|
@ -649,7 +657,9 @@ PROCESS_THREAD(shell_netperf_process, ev, data)
|
|||
shell_output_str(&netperf_command, "-------- Unicast ping-pong--------", "");
|
||||
|
||||
shell_output_str(&netperf_command, "Contacting ", recvstr);
|
||||
send_ctrl_command(&receiver, CTRL_COMMAND_CLEAR);
|
||||
while(!send_ctrl_command(&receiver, CTRL_COMMAND_CLEAR)) {
|
||||
PROCESS_PAUSE();
|
||||
}
|
||||
PROCESS_YIELD_UNTIL(ev == CONTINUE_EVENT);
|
||||
|
||||
shell_output_str(&netperf_command, "Measuring two-way unicast performance to ", recvstr);
|
||||
|
@ -667,7 +677,9 @@ PROCESS_THREAD(shell_netperf_process, ev, data)
|
|||
}
|
||||
|
||||
shell_output_str(&netperf_command, "Requesting statistics from ", recvstr);
|
||||
send_ctrl_command(&receiver, CTRL_COMMAND_STATS);
|
||||
while(!send_ctrl_command(&receiver, CTRL_COMMAND_STATS)) {
|
||||
PROCESS_PAUSE();
|
||||
}
|
||||
PROCESS_YIELD_UNTIL(ev == CONTINUE_EVENT);
|
||||
|
||||
/* Wait for reply */
|
||||
|
@ -681,7 +693,9 @@ PROCESS_THREAD(shell_netperf_process, ev, data)
|
|||
shell_output_str(&netperf_command, "-------- Unicast stream ping-pong--------", "");
|
||||
|
||||
shell_output_str(&netperf_command, "Contacting ", recvstr);
|
||||
send_ctrl_command(&receiver, CTRL_COMMAND_CLEAR);
|
||||
while(!send_ctrl_command(&receiver, CTRL_COMMAND_CLEAR)) {
|
||||
PROCESS_PAUSE();
|
||||
}
|
||||
PROCESS_YIELD_UNTIL(ev == CONTINUE_EVENT);
|
||||
|
||||
shell_output_str(&netperf_command, "Measuring two-way unicast stream performance to ", recvstr);
|
||||
|
@ -698,7 +712,9 @@ PROCESS_THREAD(shell_netperf_process, ev, data)
|
|||
}
|
||||
|
||||
shell_output_str(&netperf_command, "Requesting statistics from ", recvstr);
|
||||
send_ctrl_command(&receiver, CTRL_COMMAND_STATS);
|
||||
while(!send_ctrl_command(&receiver, CTRL_COMMAND_STATS)) {
|
||||
PROCESS_PAUSE();
|
||||
}
|
||||
PROCESS_YIELD_UNTIL(ev == CONTINUE_EVENT);
|
||||
|
||||
/* Wait for reply */
|
||||
|
|
Loading…
Reference in a new issue