summaryrefslogtreecommitdiff
path: root/components/schedule
diff options
context:
space:
mode:
authorMagnus Feuer <mfeuer@jaguarlandrover.com>2015-04-14 19:14:11 -0700
committerMagnus Feuer <mfeuer@jaguarlandrover.com>2015-04-14 19:14:11 -0700
commit5ecb4bca68e52069cb30c0bdb29f1ea1b6b31b1f (patch)
tree2edd50e7624bcf2aa1145a76e4ffc00fb78cca24 /components/schedule
parent819d72e9e0281920caadeb721f7cd18eeb63d1b0 (diff)
downloadrvi_core-5ecb4bca68e52069cb30c0bdb29f1ea1b6b31b1f.tar.gz
Fixed bug on notification management in service edge
Diffstat (limited to 'components/schedule')
-rw-r--r--components/schedule/src/schedule_rpc.erl26
1 files changed, 24 insertions, 2 deletions
diff --git a/components/schedule/src/schedule_rpc.erl b/components/schedule/src/schedule_rpc.erl
index 5980875..4d0cc6e 100644
--- a/components/schedule/src/schedule_rpc.erl
+++ b/components/schedule/src/schedule_rpc.erl
@@ -451,6 +451,7 @@ queue_message(SvcName,
case DLMod:setup_data_link(St#st.cs, SvcName, DLOp) of
[ ok, DLTimeout ] ->
+
TOut = select_timeout(RelativeTimeout, DLTimeout),
%% Setup a timeout that triggers on whatever
%% comes first of the message's general timeout
@@ -480,8 +481,29 @@ queue_message(SvcName,
ets:insert(SvcRec#service.messages_tid, Msg),
{ok, St};
- [ already_connected, _] ->
+ [ already_connected, DLTimeout] ->
%% The service may already be available, give it a shot.
+
+ TOut = select_timeout(RelativeTimeout, DLTimeout),
+
+ TRef = erlang:send_after(TOut, self(),
+ { rvi_message_timeout, SvcName, DLMod, TransID }),
+
+
+ Msg = #message {
+ transaction_id = TransID,
+ data_link = { DLMod, DLOp },
+ routes = RemainingRoutes,
+ protocol = { ProtoMod, ProtoOpt },
+ timeout = Timeout,
+ timeout_tref = TRef,
+ parameters = Parameters,
+ signature = Signature,
+ certificate = Certificate
+ },
+
+ %% Add to ets table
+ ets:insert(SvcRec#service.messages_tid, Msg),
{ _, NSt } = try_sending_messages(SvcRec, St) ,
{ ok, NSt };
@@ -518,7 +540,7 @@ try_sending_messages(#service {
available = available,
messages_tid = Tid } = SvcRec, St) ->
- ?debug("sched:try_send(): Service: ~p:~p", [DataLinkMod, SvcName]),
+ ?debug("sched:try_send(): Service: ~p:~s", [DataLinkMod, SvcName]),
%% Extract the first message of the queue.
case first_service_message(SvcRec) of