File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package io.grpc.alts.internal;
1818

19+
import static java.util.concurrent.TimeUnit.SECONDS;
20+
1921
import com.google.common.annotations.VisibleForTesting;
2022
import com.google.common.base.Optional;
2123
import io.grpc.alts.internal.HandshakerServiceGrpc.HandshakerServiceStub;
@@ -32,8 +34,13 @@ class AltsHandshakerStub {
3234
new ArrayBlockingQueue<>(1);
3335
private final AtomicReference<String> exceptionMessage = new AtomicReference<>();
3436

37+
private static final long HANDSHAKE_RPC_DEADLINE_SECS = 20;
38+
3539
AltsHandshakerStub(HandshakerServiceStub serviceStub) {
36-
this.writer = serviceStub.doHandshake(this.reader);
40+
this.writer =
41+
serviceStub
42+
.withDeadlineAfter(HANDSHAKE_RPC_DEADLINE_SECS, SECONDS)
43+
.doHandshake(this.reader);
3744
}
3845

3946
@VisibleForTesting

0 commit comments

Comments
 (0)