Process message send failure states
This commit is contained in:
parent
e805ea1aef
commit
205f323b87
|
@ -945,12 +945,8 @@ void eventloop(void) {
|
|||
// Time to give up
|
||||
own_message_send_state = IDLE;
|
||||
|
||||
if (printf("Could not get msgid for message\n") == -1) {
|
||||
err(1, "printf");
|
||||
}
|
||||
if (fflush(stdout) == EOF) {
|
||||
err(1, "fflush");
|
||||
}
|
||||
// Type of event: Msgid failed
|
||||
writeallx(1, "I", 1);
|
||||
}
|
||||
} else {
|
||||
// Found msgid
|
||||
|
@ -988,12 +984,8 @@ void eventloop(void) {
|
|||
// Time to give up
|
||||
own_message_send_state = IDLE;
|
||||
|
||||
if (printf("Could not send message %" PRIu16 "\n", own_message_msgid) == -1) {
|
||||
err(1, "printf");
|
||||
}
|
||||
if (fflush(stdout) == EOF) {
|
||||
err(1, "fflush");
|
||||
}
|
||||
// Type of event: ACK not received
|
||||
writeallx(1, "A", 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
22
ethermess.py
22
ethermess.py
|
@ -95,19 +95,27 @@ def eventloop(proc):
|
|||
msgid = readall_u16(proc.stdout)
|
||||
print('(msgid: %i)' % msgid) #debg
|
||||
|
||||
elif event_type == b'I':
|
||||
# Failed to get msgid for message
|
||||
print('(msgid fail)') #debg
|
||||
|
||||
elif event_type == b'a':
|
||||
# ACK received
|
||||
source_mac = readall(proc.stdout, 6)
|
||||
msgid = readall_u16(proc.stdout)
|
||||
print('(ack: %s %i)' % (format_mac(source_mac), msgid)) #debg
|
||||
|
||||
elif event_type == b'A':
|
||||
# ACK not received (and message send failed)
|
||||
print('(ack failed)')
|
||||
|
||||
elif event_type == b'm':
|
||||
# Message received
|
||||
source_mac = readall(proc.stdout, 6)
|
||||
message_length = readall_u16(proc.stdout)
|
||||
message = readall(proc.stdout, message_length)
|
||||
|
||||
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
|
||||
print('<%s> %s' % (format_mac(source_mac), message.decode('utf-8'))) #debg
|
||||
|
||||
else:
|
||||
# Not sth we handle yet
|
||||
|
|
Loading…
Reference in New Issue