Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,9 @@ public TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator
public TsiFrameProtector createFrameProtector(ByteBufAllocator alloc) {
return createFrameProtector(AltsTsiFrameProtector.getMaxAllowedFrameBytes(), alloc);
}

@Override
public void close() {
handshaker.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,8 @@ TsiFrameProtector createFrameProtector(ByteBufAllocator alloc) {
unwrapper = null;
return internalHandshaker.createFrameProtector(alloc);
}

void close() {
internalHandshaker.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,9 @@ private void sendHandshake(ChannelHandlerContext ctx) throws GeneralSecurityExce
}
}
}

@Override
protected void handlerRemoved0(ChannelHandlerContext ctx) throws Exception {
handshaker.close();
}
}
5 changes: 5 additions & 0 deletions alts/src/main/java/io/grpc/alts/internal/TsiHandshaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,9 @@ public interface TsiHandshaker {
* @return a new TsiFrameProtector.
*/
TsiFrameProtector createFrameProtector(ByteBufAllocator alloc);

/**
* Closes resources.
*/
void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,11 @@ public TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator
protectors.add(protector);
return protector;
}

@Override
public void close() {
delegate.close();
}
}

private static class InterceptingProtector implements TsiFrameProtector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,9 @@ public TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator
public TsiFrameProtector createFrameProtector(ByteBufAllocator alloc) {
return createFrameProtector(AltsTsiFrameProtector.getMaxAllowedFrameBytes(), alloc);
}

@Override
public void close() {
// No-op
}
}