1
0
Fork 0
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:
Gaston Dombiak 2004-09-24 02:12:47 +00:00 committed by gdombiak
parent 5ab0c1b7e7
commit aaf6cf0ca9

View file

@ -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;
} }