Skip to content

Commit

Permalink
Fixing TO0 Scheme selection issue (#685)
Browse files Browse the repository at this point in the history
  Fixing TO0 Scheme selection issue when both ownerPort & devport is
  identical.

Signed-off-by: Benny <[email protected]>
  • Loading branch information
DukeDavis12 authored Apr 17, 2024
1 parent 5920f90 commit d757e21
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void generateHello() throws IOException {
generateDiHello();
logger.info("Generating Device Credential file");
} else {
setInstructions(HttpUtils.getInstructions(devCredential.getRvInfo(), true));
setInstructions(HttpUtils.getInstructions(devCredential.getRvInfo(), true, false));

storage.put(DeviceCredential.class, devCredential);
logger.info("credentials loaded, GUID is " + devCredential.getGuid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ private static boolean containsRvVariable(RendezvousDirective directive, Rendezv
* @return A List or URL strings.
* @throws IOException An error occurred.
*/
public static List<HttpInstruction> getInstructions(RendezvousInfo info, boolean isDevice)
throws IOException {
public static List<HttpInstruction> getInstructions(RendezvousInfo info, boolean isDevice,
boolean isOwner) throws IOException {

List<HttpInstruction> list = new ArrayList<>();
for (RendezvousDirective directive : info) {
Expand Down Expand Up @@ -206,8 +206,8 @@ public static List<HttpInstruction> getInstructions(RendezvousInfo info, boolean
port = devPort;
} else {
if (ownerPort.equals((devPort)) && devSchemes.contains(HTTP_SCHEME)
&& devSchemes.size() == 1
&& !ownerOnly) {
&& devSchemes.size() == 1
&& !ownerOnly && !isOwner) {
schemes = new ArrayList<>();
schemes.add(HTTP_SCHEME);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected void generateHello() throws IOException {
byte[] headerTag = getTo0d().getVoucher().getHeader();
OwnershipVoucherHeader header =
Mapper.INSTANCE.readValue(headerTag, OwnershipVoucherHeader.class);
setInstructions(HttpUtils.getInstructions(header.getRendezvousInfo(), false));
setInstructions(HttpUtils.getInstructions(header.getRendezvousInfo(), false, true));

//remove any instruction that are rvbypass
getInstructions().removeIf(n -> n.isRendezvousBypass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public UUID apply(String serialNo, OwnershipVoucher ownershipVoucher) throws IOE

OwnershipVoucherHeader header = VoucherUtils.getHeader(ownershipVoucher);
List<HttpInstruction> h1 = HttpUtils.getInstructions(header.getRendezvousInfo(),
false);
false, false);

List<HttpInstruction> h2 = HttpUtils.getInstructions(to2Entries);

Expand Down

0 comments on commit d757e21

Please sign in to comment.