Skip to content

Commit

Permalink
fix return success response. Others.
Browse files Browse the repository at this point in the history
Add a String method to the path location in e2e request.
  • Loading branch information
juagargi authored and oncilla committed Sep 28, 2020
1 parent 796b85c commit 54fc20a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions go/cs/reservation/e2e/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,19 @@ const (
Destination
)

func (l PathLocation) String() string {
switch l {
case Source:
return "source"
case Transit:
return "trantit"
case Destination:
return "destination"
}
return "unknown path location"
}

// Location returns the location of this node in the path of the request.
func (r *SetupReq) Location() PathLocation {
switch len(r.AllocationTrail) {
case 0:
Expand Down
3 changes: 2 additions & 1 deletion go/cs/reservationstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,9 @@ func (s *Store) AdmitE2EReservation(ctx context.Context, request e2e.SetupReques

var msg base.MessageWithPath
if req.Location() == e2e.Destination {
asAResponse := failedResponse.(*e2e.ResponseSetupFailure)
msg = &e2e.ResponseSetupSuccess{
Response: failedResponse.(*e2e.ResponseSetupFailure).Response,
Response: *morphE2EResponseToSuccess(&asAResponse.Response),
Token: *index.Token,
}
} else {
Expand Down

0 comments on commit 54fc20a

Please sign in to comment.