Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add functions that returns remaining time in ZRTP discovery phase.

Patch from Damian Minkov.
  • Loading branch information...
commit d4c7c66d5170761533c0e5f1bb8c4b169b023b0b 1 parent 4aef0c0
@wernerd authored
Showing with 32 additions and 0 deletions.
  1. +16 −0 src/gnu/java/zrtp/ZRtp.java
  2. +16 −0 src/gnu/java/zrtp/ZrtpStateClass.java
View
16 src/gnu/java/zrtp/ZRtp.java
@@ -971,6 +971,22 @@ public void conf2AckSecure() {
return ret;
}
+ /**
+ * Get remaining time before a "ZRTP not supported by other party" is reported.
+ *
+ * This function calls the protocol state engine to determine how many time is left
+ * in ZRTP's discovery phase (Hello phase).
+ *
+ * @return Time left in milliseconds.
+ */
+ public long getTimeoutValue() {
+ if(stateEngine != null) {
+ return stateEngine.getTimeoutValue();
+ }
+
+ return -1;
+ }
+
/*
* The following methods are helper functions for ZrtpStateClass.
* ZrtpStateClass calls them to prepare packets, send data, report problems,
View
16 src/gnu/java/zrtp/ZrtpStateClass.java
@@ -208,6 +208,22 @@ protected ZrtpStateClass(ZRtp p) {
}
+ public long getTimeoutValue() {
+ long res = 0;
+ int counter = 0;
+ int time = t1.start;
+
+ do {
+ res += time;
+ time += time;
+ time = (time > t1.capping)? t1.capping : time;
+ counter++;
+ }
+ while(counter < t1.maxResend);
+
+ return res;
+ }
+
protected synchronized void processEvent(Event ev) {
char first, middle, last;
Please sign in to comment.
Something went wrong with that request. Please try again.