for loop bug fixed

pull/12/head
Tom Early 7 years ago
parent a5286ede78
commit aadb94ad33

@ -1054,41 +1054,43 @@ void CQnetGateway::ProcessG2(const ssize_t g2buflen, const SDSVT &g2buf, const b
} else { // g2buflen == 27 } else { // g2buflen == 27
/* find out which repeater module to send the data to */ /* find out which repeater module to send the data to */
int i; int i;
for (i=0; i<3 && rptr.mod[i].defined; i++) { for (i=0; i<3; i++) {
/* streamid match ? */ if (rptr.mod[i].defined) {
bool match = (toRptr[i].streamid == g2buf.streamid); /* streamid match ? */
if (is_from_g2) bool match = (toRptr[i].streamid == g2buf.streamid);
match = match && (toRptr[i].adr == fromDst4.sin_addr.s_addr); if (is_from_g2)
if (match) { match = match && (toRptr[i].adr == fromDst4.sin_addr.s_addr);
memcpy(rptrbuf.pkt_id, "DSTR", 4); if (match) {
rptrbuf.counter = htons(toRptr[i].G2_COUNTER++); memcpy(rptrbuf.pkt_id, "DSTR", 4);
rptrbuf.flag[0] = 0x73U; rptrbuf.counter = htons(toRptr[i].G2_COUNTER++);
rptrbuf.flag[1] = 0x12U; rptrbuf.flag[0] = 0x73U;
rptrbuf.flag[2] = 0x00U; rptrbuf.flag[1] = 0x12U;
rptrbuf.remaining= 0x13U; rptrbuf.flag[2] = 0x00U;
rptrbuf.vpkt.icm_id = 0x20U; rptrbuf.remaining= 0x13U;
memcpy(&rptrbuf.vpkt.dst_rptr_id, g2buf.flagb, 18); rptrbuf.vpkt.icm_id = 0x20U;
memcpy(&rptrbuf.vpkt.dst_rptr_id, g2buf.flagb, 18);
Gate2Modem[i].Write(rptrbuf.pkt_id, 29); Gate2Modem[i].Write(rptrbuf.pkt_id, 29);
/* timeit */ /* timeit */
time(&toRptr[i].last_time); time(&toRptr[i].last_time);
toRptr[i].sequence = rptrbuf.vpkt.ctrl; toRptr[i].sequence = rptrbuf.vpkt.ctrl;
/* End of stream ? */ /* End of stream ? */
if (g2buf.ctrl & 0x40U) { if (g2buf.ctrl & 0x40U) {
/* clear the saved header */ /* clear the saved header */
memset(toRptr[i].saved_hdr.pkt_id, 0, 58); memset(toRptr[i].saved_hdr.pkt_id, 0, 58);
toRptr[i].saved_adr = 0; toRptr[i].saved_adr = 0;
toRptr[i].last_time = 0; toRptr[i].last_time = 0;
toRptr[i].streamid = 0; toRptr[i].streamid = 0;
toRptr[i].adr = 0; toRptr[i].adr = 0;
if (bool_qso_details) if (bool_qso_details)
printf("id=%04x END\n", ntohs(g2buf.streamid)); printf("id=%04x END\n", ntohs(g2buf.streamid));
} }
break; break; // we're done
}
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.