| OLD | NEW |
| 1 /* | 1 /* |
| 2 * DTLS Protocol | 2 * DTLS Protocol |
| 3 * | 3 * |
| 4 * ***** BEGIN LICENSE BLOCK ***** | 4 * ***** BEGIN LICENSE BLOCK ***** |
| 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 6 * | 6 * |
| 7 * The contents of this file are subject to the Mozilla Public License Version | 7 * The contents of this file are subject to the Mozilla Public License Version |
| 8 * 1.1 (the "License"); you may not use this file except in compliance with | 8 * 1.1 (the "License"); you may not use this file except in compliance with |
| 9 * the License. You may obtain a copy of the License at | 9 * the License. You may obtain a copy of the License at |
| 10 * http://www.mozilla.org/MPL/ | 10 * http://www.mozilla.org/MPL/ |
| (...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 records->right = new_right; | 1127 records->right = new_right; |
| 1128 records->left = new_left; | 1128 records->left = new_left; |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 offset = seq % DTLS_RECVD_RECORDS_WINDOW; | 1131 offset = seq % DTLS_RECVD_RECORDS_WINDOW; |
| 1132 | 1132 |
| 1133 records->data[offset / 8] |= (1 << (offset % 8)); | 1133 records->data[offset / 8] |= (1 << (offset % 8)); |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 SECStatus | 1136 SECStatus |
| 1137 DTLS_GetTimeout(PRFileDesc *socket, PRIntervalTime *timeout) | 1137 DTLS_GetHandshakeTimeout(PRFileDesc *socket, PRIntervalTime *timeout) |
| 1138 { | 1138 { |
| 1139 sslSocket * ss = NULL; | 1139 sslSocket * ss = NULL; |
| 1140 PRIntervalTime elapsed; | 1140 PRIntervalTime elapsed; |
| 1141 PRIntervalTime desired; | 1141 PRIntervalTime desired; |
| 1142 | 1142 |
| 1143 ss = ssl_FindSocket(socket); | 1143 ss = ssl_FindSocket(socket); |
| 1144 | 1144 |
| 1145 if (!ss) | 1145 if (!ss) |
| 1146 return SECFailure; | 1146 return SECFailure; |
| 1147 | 1147 |
| 1148 if (!IS_DTLS(ss)) | 1148 if (!IS_DTLS(ss)) |
| 1149 return SECFailure; | 1149 return SECFailure; |
| 1150 | 1150 |
| 1151 if (!ss->ssl3.hs.rtTimerCb) | 1151 if (!ss->ssl3.hs.rtTimerCb) |
| 1152 return SECFailure; | 1152 return SECFailure; |
| 1153 | 1153 |
| 1154 elapsed = PR_IntervalNow() - ss->ssl3.hs.rtTimerStarted; | 1154 elapsed = PR_IntervalNow() - ss->ssl3.hs.rtTimerStarted; |
| 1155 desired = PR_MillisecondsToInterval(ss->ssl3.hs.rtTimeoutMs); | 1155 desired = PR_MillisecondsToInterval(ss->ssl3.hs.rtTimeoutMs); |
| 1156 if (elapsed > desired) { | 1156 if (elapsed > desired) { |
| 1157 /* Timer expired */ | 1157 /* Timer expired */ |
| 1158 *timeout = PR_INTERVAL_NO_WAIT; | 1158 *timeout = PR_INTERVAL_NO_WAIT; |
| 1159 } else { | 1159 } else { |
| 1160 *timeout = desired - elapsed; | 1160 *timeout = desired - elapsed; |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 return SECSuccess; | 1163 return SECSuccess; |
| 1164 } | 1164 } |
| OLD | NEW |