Expose public getDepth method
The clone or fetch depth is a valuable bit of information for access logging. Create a public getter to faciliate access. A precondition check prevents unintentional misuse when the data isn't valid yet. Change-Id: I4603d5fd3bd4a767e3e2419b0f2da3664cfbd7f8 Signed-off-by: David Pletcher <dpletcher@google.com>
This commit is contained in:
parent
41c4f9cb2a
commit
12e38d7275
|
@ -884,6 +884,19 @@ private void recvWants() throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the clone/fetch depth. Valid only after calling recvWants().
|
||||
*
|
||||
* @return the depth requested by the client, or 0 if unbounded.
|
||||
* @since 4.0
|
||||
*/
|
||||
public int getDepth() {
|
||||
if (options == null) {
|
||||
throw new IllegalStateException("do not call getDepth() before recvWants()");
|
||||
}
|
||||
return depth;
|
||||
}
|
||||
|
||||
private boolean negotiate() throws IOException {
|
||||
okToGiveUp = Boolean.FALSE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue