Permalink
Browse files

Not reconnecting after a quick shutdown, fixd.

  • Loading branch information...
1 parent 3a52ce7 commit d2dd28c853853531761786657ef90f4a84472c79 Caleb James DeLisle committed Aug 30, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 net/DefaultInterfaceController.c
@@ -242,7 +242,6 @@ static uint8_t receivedAfterCryptoAuth(struct Message* msg, struct Interface* cr
struct Endpoint* ep = cryptoAuthIf->receiverContext;
struct Context* ic = interfaceControllerForEndpoint(ep);
- ep->timeOfLastMessage = Time_currentTimeMilliseconds(ic->eventBase);
if (ep->state != Endpoint_state_ESTABLISHED) {
if (CryptoAuth_getState(cryptoAuthIf) == CryptoAuth_ESTABLISHED) {
moveEndpointIfNeeded(ep, ic);
@@ -258,6 +257,7 @@ static uint8_t receivedAfterCryptoAuth(struct Message* msg, struct Interface* cr
}
}
}
+ ep->timeOfLastMessage = Time_currentTimeMilliseconds(ic->eventBase);
return ep->switchIf.receiveMessage(msg, &ep->switchIf);
}
@@ -396,6 +396,13 @@ static struct Endpoint* insertEndpoint(uint8_t key[InterfaceController_KEY_SIZE]
return NULL;
}
+ // If the other end need not supply a valid password to connect
+ // we will set the connection state to HANDSHAKE because we don't
+ // want the connection to be trashed after the first invalid packet.
+ if (!requireAuth) {
+ ep->state = Endpoint_state_HANDSHAKE;
+ }
+
// This is the same no matter what endpoint.
externalInterface->receiverContext = ic;
externalInterface->receiveMessage = receiveMessage;

0 comments on commit d2dd28c

Please sign in to comment.