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.
27
struct NetTesterSM:public Continuation
30
IOBufferReader *reader;
34
NetTesterSM(ProxyMutex * _mutex, NetVConnection * _vc):Continuation(_mutex)
36
MUTEX_TRY_LOCK(lock, mutex, _vc->thread);
37
ink_release_assert(lock);
39
SET_HANDLER(&NetTesterSM::handle_read);
40
buf = new_MIOBuffer(8);
41
reader = buf->alloc_reader();
42
read_vio = vc->do_io_read(this, INT64_MAX, buf);
46
int handle_read(int event, void *data)
51
case VC_EVENT_READ_READY:
52
r = reader->read_avail();
53
str = NEW(new char[r + 10]);
58
case VC_EVENT_READ_COMPLETE:
61
r = reader->read_avail();
62
str = NEW(new char[r + 10]);
70
ink_release_assert(!"unknown event");
80
struct NetTesterAccept:public Continuation
83
NetTesterAccept(ProxyMutex * _mutex):Continuation(_mutex)
85
SET_HANDLER(&NetTesterAccept::handle_accept);
88
int handle_accept(int event, void *data)
90
printf("Accepted a connection\n");
92
NetVConnection *vc = (NetVConnection *) data;
93
NEW(new NetTesterSM(new_ProxyMutex(), vc));
106
ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
107
MIOBuffer *mbuf = new_MIOBuffer(5);
108
eventProcessor.start(1);
109
netProcessor.start();
110
netProcessor.accept(NEW(new NetTesterAccept(new_ProxyMutex())), 8080, true);
111
this_thread()->execute();