Process ACK
This commit is contained in:
parent
59cce635c7
commit
e805ea1aef
|
@ -805,16 +805,14 @@ void handle_ack(const unsigned char source_mac[6], const unsigned char *data, si
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char mac[18];
|
// Type of event: ACK received
|
||||||
format_mac(source_mac, mac);
|
writeallx(1, "a", 1);
|
||||||
|
|
||||||
if (printf("%s ack %" PRIu16 "\n", mac, msgid) == -1) {
|
// MAC
|
||||||
err(1, "printf");
|
writeallx(1, source_mac, 6);
|
||||||
}
|
|
||||||
|
|
||||||
if (fflush(stdout) == EOF) {
|
// Msgid
|
||||||
err(1, "fflush");
|
writeallx_u16(1, msgid);
|
||||||
}
|
|
||||||
|
|
||||||
if (own_message_send_state == WAITING_ACK && msgid == own_message_msgid) {
|
if (own_message_send_state == WAITING_ACK && msgid == own_message_msgid) {
|
||||||
own_message_send_state = IDLE;
|
own_message_send_state = IDLE;
|
||||||
|
|
|
@ -92,7 +92,7 @@ def eventloop(proc):
|
||||||
|
|
||||||
elif event_type == b'i':
|
elif event_type == b'i':
|
||||||
# Msgid for message
|
# Msgid for message
|
||||||
msgid = readall_u16(proc.stdout);
|
msgid = readall_u16(proc.stdout)
|
||||||
print('(msgid: %i)' % msgid) #debg
|
print('(msgid: %i)' % msgid) #debg
|
||||||
|
|
||||||
elif event_type == b'm':
|
elif event_type == b'm':
|
||||||
|
@ -103,6 +103,12 @@ def eventloop(proc):
|
||||||
|
|
||||||
print('<%s> %s' % (format_mac(source_mac), message.decode('utf-8')))
|
print('<%s> %s' % (format_mac(source_mac), message.decode('utf-8')))
|
||||||
|
|
||||||
|
elif event_type == b'a':
|
||||||
|
# ACK received
|
||||||
|
source_mac = readall(proc.stdout, 6)
|
||||||
|
msgid = readall_u16(proc.stdout)
|
||||||
|
print('(ack: %i)' % msgid) #debg
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Not sth we handle yet
|
# Not sth we handle yet
|
||||||
data = proc.stdout.read(1023)
|
data = proc.stdout.read(1023)
|
||||||
|
|
Loading…
Reference in New Issue