Commit 87541ec5 authored by afreyssin's avatar afreyssin

Bug fix: Test if the client context is valid (JORAM-281).

parent dea73ebc
/* /*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging * JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2006 ScalAgent Distributed Technologies * Copyright (C) 2001 - 2017 ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 Dyade * Copyright (C) 1996 - 2000 Dyade
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
*/ */
package org.objectweb.joram.mom.notifications; package org.objectweb.joram.mom.notifications;
import org.objectweb.joram.mom.proxies.UserAgent;
import fr.dyade.aaa.agent.AgentId; import fr.dyade.aaa.agent.AgentId;
import fr.dyade.aaa.common.encoding.Decoder; import fr.dyade.aaa.common.encoding.Decoder;
import fr.dyade.aaa.common.encoding.EncodableHelper; import fr.dyade.aaa.common.encoding.EncodableHelper;
...@@ -129,13 +131,18 @@ public class ReceiveRequest extends AbstractRequestNot { ...@@ -129,13 +131,18 @@ public class ReceiveRequest extends AbstractRequestNot {
if (timeOut > 0) if (timeOut > 0)
this.expirationTime = startTime + timeOut; this.expirationTime = startTime + timeOut;
} }
/** /**
* Returns <code>false</code> if the request expired. * Returns <code>false</code> if the request expired.
* *
* @param currentTime The current time to verify the expiration time. * @param currentTime The current time to verify the expiration time.
*/ */
public boolean isValid(long currentTime) { public boolean isValid(long currentTime) {
// TODO (AF): May be we have to memorize the CCUID in order to avoid to create
// multiples instances.
if (! UserAgent.isValidCC(requester, getClientContext()))
// The client context is no longer valid (JORAM-281).
return false;
if (timeOut > 0) if (timeOut > 0)
return currentTime < expirationTime; return currentTime < expirationTime;
return true; return true;
...@@ -231,5 +238,4 @@ public class ReceiveRequest extends AbstractRequestNot { ...@@ -231,5 +238,4 @@ public class ReceiveRequest extends AbstractRequestNot {
} }
timeOut = decoder.decodeUnsignedLong(); timeOut = decoder.decodeUnsignedLong();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment