Skip to content

Commit

Permalink
b/198398480 Handle VM lookup failures (#558)
Browse files Browse the repository at this point in the history
Map VM lookup failures like access failures and
theow an UnauthorizedException.
  • Loading branch information
jpassing authored Sep 1, 2021
1 parent fe847c0 commit 0bbca5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion sources/Google.Solutions.IapTunneling/Iap/Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public enum CloseCode : int
DESTINATION_READ_FAILED = 4010,

INVALID_DATA = 4013,
NOT_AUTHORIZED = 4033
NOT_AUTHORIZED = 4033,
LOOKUP_FAILED = 4047,
LOOKUP_FAILED_RECONNECT = 4051
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion sources/Google.Solutions.IapTunneling/Iap/SshRelayStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ public async Task TestConnectionAsync(TimeSpan timeout)
}
}
catch (WebSocketStreamClosedByServerException e)
when ((CloseCode)e.CloseStatus == CloseCode.NOT_AUTHORIZED)
when ((CloseCode)e.CloseStatus == CloseCode.NOT_AUTHORIZED ||
(CloseCode)e.CloseStatus == CloseCode.LOOKUP_FAILED ||
(CloseCode)e.CloseStatus == CloseCode.LOOKUP_FAILED_RECONNECT)
{
//
// Request was rejected by access level or IAM policy.
Expand Down

0 comments on commit 0bbca5d

Please sign in to comment.