3
A brief file description
5
@section license License
7
Licensed to the Apache Software Foundation (ASF) under one
8
or more contributor license agreements. See the NOTICE file
9
distributed with this work for additional information
10
regarding copyright ownership. The ASF licenses this file
11
to you under the Apache License, Version 2.0 (the
12
"License"); you may not use this file except in compliance
13
with the License. You may obtain a copy of the License at
15
http://www.apache.org/licenses/LICENSE-2.0
17
Unless required by applicable law or agreed to in writing, software
18
distributed under the License is distributed on an "AS IS" BASIS,
19
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
See the License for the specific language governing permissions and
21
limitations under the License.
24
/**************************************************************************
25
Verification of INKqa06643
27
Schedule a continuation that is simply called back with a later timeout
28
value. Explicitly call TSContSchedule() without a mutex, the mutex should
29
be created in InkAPI.cc/TSContSchedule.
31
This plug-in will not complete the client request (request times-out),
32
since the event routine calls TSContSchedule() in the event handler.
33
A simple change to the event routine can be made so that TSHttpTxnReenable()
34
is called in place of TSContSchedule().
36
Entry points to the core now use either
41
to create/init a mutex.
43
**************************************************************************/
46
#include <sys/types.h>
51
/* Verification code for: TSqa06643 */
53
EventHandler(TSCont contp, TSEvent event, void *eData)
55
TSHttpTxn txn = (TSHttpTxn)eData;
59
if (time(&tVal) != (time_t)(-1)) {
60
TSDebug("tag_sched6643",
61
"TSContSchedule: EventHandler: called at %s\n",
65
iVal = (int)TSContDataGet(contp);
67
TSDebug("tag_sched6643",
68
"TSContSchedule: handler called with value %d\n",iVal);
72
case TS_EVENT_HTTP_OS_DNS:
73
TSDebug("tag_sched6643",
74
"TSContSchedule: Seed event %s\n", "TS_EVENT_HTTP_OS_DNS");
77
case TS_EVENT_TIMEOUT:
78
TSDebug("tag_sched6643",
79
"TSContSchedule: TIMEOUT event\n");
83
TSDebug("tag_sched6643",
84
"TSContSchedule: Error: default event\n");
88
iVal += 100; /* seed + timeout val */
89
TSContDataSet(contp, (void*)iVal);
90
TSContSchedule(contp,iVal);
92
/* TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE); */
96
EventHandler2(TSCont contp, TSEvent event, void *eData)
101
TSPluginInit(int argc, const char* argv[])
103
TSCont contp, contp2;
106
TSDebug("tag_sched6643",
107
"TSContSchedule: Initial data value for contp is %d\n",timeOut);
109
/* contp = TSContCreate(EventHandler, TSMutexCreate() ); */
110
mymUtex = TSMutexCreate() ;
112
contp = TSContCreate(EventHandler, myMutex);
113
TSContDataSet(contp, (void*)timeOut);
115
contp2 = TSContCreate(EventHandler2, myMutex);
116
TSContDataSet(contp2, (void*)contp);
118
/* TSHttpHookAdd(TS_HTTP_OS_DNS_HOOK, contp); */
119
TSHttpHookAdd(TS_HTTP_OS_DNS_HOOK, contp2);