fix for switch connecting
Change-Id: If4e16a692f79f94289bd0df4a0ffbb3dd828e246
Showing
1 changed file
with
20 additions
and
7 deletions
| ... | @@ -457,9 +457,17 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -457,9 +457,17 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { |
| 457 | // will never be called. We override processOFMessage | 457 | // will never be called. We override processOFMessage |
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | + | ||
| 461 | + | ||
| 460 | @Override | 462 | @Override |
| 461 | void processOFMessage(OFChannelHandler h, OFMessage m) | 463 | void processOFMessage(OFChannelHandler h, OFMessage m) |
| 462 | throws IOException, SwitchStateException { | 464 | throws IOException, SwitchStateException { |
| 465 | + | ||
| 466 | + if (h.sw.isDriverHandshakeComplete()) { | ||
| 467 | + moveToActive(h); | ||
| 468 | + | ||
| 469 | + } | ||
| 470 | + | ||
| 463 | if (m.getType() == OFType.ECHO_REQUEST) { | 471 | if (m.getType() == OFType.ECHO_REQUEST) { |
| 464 | processOFEchoRequest(h, (OFEchoRequest) m); | 472 | processOFEchoRequest(h, (OFEchoRequest) m); |
| 465 | } else if (m.getType() == OFType.ECHO_REPLY) { | 473 | } else if (m.getType() == OFType.ECHO_REPLY) { |
| ... | @@ -470,6 +478,7 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -470,6 +478,7 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { |
| 470 | if (!h.sw.handleRoleError((OFErrorMsg)m)) { | 478 | if (!h.sw.handleRoleError((OFErrorMsg)m)) { |
| 471 | h.sw.processDriverHandshakeMessage(m); | 479 | h.sw.processDriverHandshakeMessage(m); |
| 472 | if (h.sw.isDriverHandshakeComplete()) { | 480 | if (h.sw.isDriverHandshakeComplete()) { |
| 481 | + moveToActive(h); | ||
| 473 | h.setState(ACTIVE); | 482 | h.setState(ACTIVE); |
| 474 | } | 483 | } |
| 475 | } | 484 | } |
| ... | @@ -481,13 +490,7 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -481,13 +490,7 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { |
| 481 | } else { | 490 | } else { |
| 482 | h.sw.processDriverHandshakeMessage(m); | 491 | h.sw.processDriverHandshakeMessage(m); |
| 483 | if (h.sw.isDriverHandshakeComplete()) { | 492 | if (h.sw.isDriverHandshakeComplete()) { |
| 484 | - boolean success = h.sw.connectSwitch(); | 493 | + moveToActive(h); |
| 485 | - | ||
| 486 | - if (!success) { | ||
| 487 | - disconnectDuplicate(h); | ||
| 488 | - return; | ||
| 489 | - } | ||
| 490 | - h.setState(ACTIVE); | ||
| 491 | } | 494 | } |
| 492 | } | 495 | } |
| 493 | } | 496 | } |
| ... | @@ -498,6 +501,16 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -498,6 +501,16 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { |
| 498 | throws IOException, SwitchStateException { | 501 | throws IOException, SwitchStateException { |
| 499 | h.pendingPortStatusMsg.add(m); | 502 | h.pendingPortStatusMsg.add(m); |
| 500 | } | 503 | } |
| 504 | + | ||
| 505 | + private void moveToActive(OFChannelHandler h) { | ||
| 506 | + boolean success = h.sw.connectSwitch(); | ||
| 507 | + h.setState(ACTIVE); | ||
| 508 | + if (!success) { | ||
| 509 | + disconnectDuplicate(h); | ||
| 510 | + return; | ||
| 511 | + } | ||
| 512 | + } | ||
| 513 | + | ||
| 501 | }, | 514 | }, |
| 502 | 515 | ||
| 503 | 516 | ... | ... |
-
Please register or login to post a comment