Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
testutil: don't dup result chan write for NodeConnected/Disconnected
Browse files Browse the repository at this point in the history
The NodeConnected/Disconnected() helpers are a little odd in how they're
disjoint from all the other events which flow through EventNotify().  They
event shouldn't be processed in both places.  Insure that by returning from
EventNotify() in the case those are the event being processed.

Signed-off-by: Tim Pepper <[email protected]>
  • Loading branch information
Tim Pepper committed Aug 19, 2016
1 parent 4fb5889 commit 97711a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions testutil/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@ func (client *SsntpTestClient) EventNotify(event ssntp.Event, frame *ssntp.Frame
var result Result

switch event {
case ssntp.NodeConnected:
//handled by ConnectNotify()
return
case ssntp.NodeDisconnected:
//handled by DisconnectNotify()
return
case ssntp.TenantAdded:
var tenantAddedEvent payloads.EventTenantAdded

Expand Down
8 changes: 6 additions & 2 deletions testutil/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,14 @@ func (ctl *SsntpTestController) EventNotify(event ssntp.Event, frame *ssntp.Fram
var result Result

switch event {
// case ssntp.NodeConnected: handled by ConnectNotify()
// case ssntp.NodeDisconnected: handled by DisconnectNotify()
// case ssntp.TenantAdded: does not reach controller
// case ssntp.TenantRemoved: does not reach controller
case ssntp.NodeConnected:
//handled by ConnectNotify()
return
case ssntp.NodeDisconnected:
//handled by DisconnectNotify()
return
case ssntp.PublicIPAssigned:
var publicIPAssignedEvent payloads.EventPublicIPAssigned

Expand Down

0 comments on commit 97711a5

Please sign in to comment.