This fixes the problem where two nodes send a REQ_KEY to each other
simultaneously, which causes both of them to drop their current state
and respond to the other's REQ_KEY with an ANS_KEY, which won't succeed
any more because both of them forgot that state.
return true;
}
- if(from->sptps.label)
+ if(from->sptps.label) {
logger(mesh, MESHLINK_DEBUG, "Got REQ_KEY from %s while we already started a SPTPS session!", from->name);
+ if(strcmp(mesh->self->name, from->name) < 0) {
+ logger(mesh, MESHLINK_DEBUG, "Ignoring REQ_KEY from %s.", from->name);
+ return true;
+ }
+ }
char buf[MAX_STRING_SIZE];
int len;