mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-27 06:22:07 +01:00
Adds security checks to ensure that PacketReplyTime is always greater than 0.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2384 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
5ab0c1b7e7
commit
aaf6cf0ca9
1 changed files with 7 additions and 0 deletions
|
@ -158,6 +158,10 @@ public final class SmackConfiguration {
|
||||||
* @return the milliseconds to wait for a response from the server
|
* @return the milliseconds to wait for a response from the server
|
||||||
*/
|
*/
|
||||||
public static int getPacketReplyTimeout() {
|
public static int getPacketReplyTimeout() {
|
||||||
|
// The timeout value must be greater than 0 otherwise we will answer the default value
|
||||||
|
if (packetReplyTimeout <= 0) {
|
||||||
|
packetReplyTimeout = 5000;
|
||||||
|
}
|
||||||
return packetReplyTimeout;
|
return packetReplyTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +172,9 @@ public final class SmackConfiguration {
|
||||||
* @param timeout the milliseconds to wait for a response from the server
|
* @param timeout the milliseconds to wait for a response from the server
|
||||||
*/
|
*/
|
||||||
public static void setPacketReplyTimeout(int timeout) {
|
public static void setPacketReplyTimeout(int timeout) {
|
||||||
|
if (timeout <= 0) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
packetReplyTimeout = timeout;
|
packetReplyTimeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue