Skip to content
Browse files

dhcp: optimisation, added TODO

  • Loading branch information...
1 parent d3eaa7a commit aa442ea8fb088c6879f1e9a34fba9cb806680232 @ZoltanBojthe ZoltanBojthe committed Mar 25, 2013
Showing with 8 additions and 11 deletions.
  1. +2 −0 __TODO
  2. +6 −11 src/applications/dhcp/DHCPClient.cc
View
2 __TODO
@@ -1,3 +1,5 @@
+TODO: DHCP Client should work multiple interfaces, but works with only one.
+
TODO: TCP, UDP, and other protocols: must be implement an IProtocol, IProtocol has a getMyProtocolIDs() function,
and IPv4, IPv6 get it instead protocolmapping parameter.
View
17 src/applications/dhcp/DHCPClient.cc
@@ -165,22 +165,19 @@ void DHCPClient::changeFSMState(CLIENT_STATE new_state)
changeFSMState(SELECTING);
}
-
- if (new_state == SELECTING)
+ else if (new_state == SELECTING)
{
// the selected lease is in lease
sendDiscover();
scheduleTimer_TO(WAIT_OFFER);
}
-
- if (new_state == REQUESTING)
+ else if (new_state == REQUESTING)
{
// the selected lease is in lease
sendRequest();
scheduleTimer_TO(WAIT_ACK);
}
-
- if (new_state == BOUND)
+ else if (new_state == BOUND)
{
cancelTimer_TO();
scheduleTimer_T1();
@@ -223,15 +220,13 @@ void DHCPClient::changeFSMState(CLIENT_STATE new_state)
nb->fireChangeNotification(NF_INTERFACE_IPv4CONFIG_CHANGED, ie);
EV << "publishing the configuration change into the blackboard" << endl;
}
-
- if (new_state == RENEWING)
+ else if (new_state == RENEWING)
{
// asking for lease renewal
sendRequest();
scheduleTimer_TO(WAIT_ACK);
}
-
- if (new_state == REBINDING)
+ else if (new_state == REBINDING)
{
// asking for lease rebinding
cancelTimer_T1();
@@ -241,7 +236,6 @@ void DHCPClient::changeFSMState(CLIENT_STATE new_state)
sendRequest();
scheduleTimer_TO(WAIT_ACK);
}
-
}
void DHCPClient::handleMessage(cMessage *msg)
@@ -647,3 +641,4 @@ bool DHCPClient::handleOperationStage(LifecycleOperation *operation, int stage,
else throw cRuntimeError("Unsupported lifecycle operation '%s'", operation->getClassName());
return true;
}
+

0 comments on commit aa442ea

Please sign in to comment.
Something went wrong with that request. Please try again.