mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Process incoming stream packets
This commit is contained in:
parent
4d674d06b9
commit
2193d8fb74
@ -595,8 +595,13 @@ static void interface_read_stream(struct overlay_interface *interface){
|
||||
WHY_perror("read");
|
||||
return;
|
||||
}
|
||||
|
||||
struct slip_decode_state *state=&interface->slip_decode_state;
|
||||
|
||||
if (config.debug.slip)
|
||||
dump("RX bytes",&state->src[state->src_offset],
|
||||
state->src_size-state->src_offset);
|
||||
|
||||
state->src=buffer;
|
||||
state->src_size=nread;
|
||||
state->src_offset=0;
|
||||
@ -604,7 +609,7 @@ static void interface_read_stream(struct overlay_interface *interface){
|
||||
while (state->src_offset < state->src_size) {
|
||||
int ret = slip_decode(state);
|
||||
if (ret==1){
|
||||
packetOkOverlay(interface, state->dst, state->dst_offset, -1, NULL, -1);
|
||||
packetOkOverlay(interface, state->dst, state->packet_length, -1, NULL, -1);
|
||||
state->dst_offset=0;
|
||||
}
|
||||
}
|
||||
|
4
slip.c
4
slip.c
@ -235,8 +235,6 @@ int slip_decode(struct slip_decode_state *state)
|
||||
case SLIP_FORMAT_UPPER7:
|
||||
{
|
||||
if (config.debug.slip) {
|
||||
dump("RX bytes",&state->src[state->src_offset],
|
||||
state->src_size-state->src_offset);
|
||||
if (state->rssi_len<0) state->rssi_len=0;
|
||||
if (state->rssi_len>=RSSI_TEXT_SIZE) state->rssi_len=RSSI_TEXT_SIZE-1;
|
||||
state->rssi_text[state->rssi_len]=0;
|
||||
@ -257,7 +255,7 @@ int slip_decode(struct slip_decode_state *state)
|
||||
} else {
|
||||
if (config.debug.packetradio)
|
||||
DEBUGF("Accepted packet of %d bytes (CRC ok)",state->packet_length);
|
||||
return state->packet_length;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user