This is an automated email from the ASF dual-hosted git repository. bcall pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 9f86851 Kill unused .c file with C++ code. 9f86851 is described below commit 9f86851538f3b12eab6dfbc2c73b78db4ffbfb87 Author: Walt Karas <wka...@yahoo-inc.com> AuthorDate: Fri Oct 20 22:36:00 2017 +0000 Kill unused .c file with C++ code. --- iocore/net/Makefile.am | 5 -- iocore/net/NetTest-http-server.c | 174 --------------------------------------- 2 files changed, 179 deletions(-) diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am index aaa7e94..ae329ab 100644 --- a/iocore/net/Makefile.am +++ b/iocore/net/Makefile.am @@ -155,11 +155,6 @@ libinknet_a_SOURCES = \ UnixUDPNet.cc \ SSLDynlock.cc -#test_UNUSED_SOURCES = \ -# NetTest-http-server.c \ -# test_I_Net.cc \ -# test_P_Net.cc - if BUILD_TESTS libinknet_a_SOURCES += \ NetVCTest.cc \ diff --git a/iocore/net/NetTest-http-server.c b/iocore/net/NetTest-http-server.c deleted file mode 100644 index 85ed37c..0000000 --- a/iocore/net/NetTest-http-server.c +++ /dev/null @@ -1,174 +0,0 @@ -/** @file - - A brief file description - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -IOBufferBlock *resp_blk; -int doc_len; - -struct NetTesterSM : public Continuation { - VIO *read_vio; - IOBufferReader *reader, *resp_reader; - NetVConnection *vc; - MIOBuffer *req_buf, *resp_buf; - char request[2000]; - int req_len; - - NetTesterSM(ProxyMutex *_mutex, NetVConnection *_vc) : Continuation(_mutex) - { - MUTEX_TRY_LOCK(lock, mutex, _vc->thread); - ink_release_assert(lock); - vc = _vc; - Debug("net_test", "Accepted a connection"); - SET_HANDLER(&NetTesterSM::handle_read); - req_buf = new_MIOBuffer(1); - reader = req_buf->alloc_reader(); - read_vio = vc->do_io_read(this, INT64_MAX, req_buf); - // vc->set_inactivity_timeout(HRTIME_SECONDS(60)); - resp_buf = new_empty_MIOBuffer(6); - resp_buf->append_block(resp_blk->clone()); - req_len = 0; - resp_reader = resp_buf->alloc_reader(); - } - - ~NetTesterSM() - { - req_buf->dealloc_all_readers(); - req_buf->clear(); - free_MIOBuffer(req_buf); - - resp_buf->dealloc_all_readers(); - resp_buf->clear(); - free_MIOBuffer(resp_buf); - } - - /* ********************* jtest sample request ********************** - GET http://npdev:8080/0.5216393021/6000 HTTP/1.0 - Proxy-Connection: Keep-Alive - */ - - int - handle_read(int event, void *data) - { - int r; - char *str; - switch (event) { - case VC_EVENT_READ_READY: - r = reader->read_avail(); - reader->read(&request[req_len], r); - req_len += r; - request[req_len] = 0; - Debug("net_test", "%s", request); - fflush(stdout); - // vc->set_inactivity_timeout(HRTIME_SECONDS(30)); - if (strcmp(&request[req_len - 4], "\r\n\r\n") == 0) { - Debug("net_test", "The request header is :\n%s", request); - // parse and get the doc size - SET_HANDLER(&NetTesterSM::handle_write); - ink_assert(doc_len == resp_reader->read_avail()); - vc->do_io_write(this, doc_len, resp_reader); - // vc->set_inactivity_timeout(HRTIME_SECONDS(10)); - } - break; - case VC_EVENT_READ_COMPLETE: - /* FALLSTHROUGH */ - case VC_EVENT_EOS: - r = reader->read_avail(); - str = new char[r + 10]; - reader->read(str, r); - Debug("net_test", "%s", str); - fflush(stdout); - case VC_EVENT_ERROR: - case VC_EVENT_INACTIVITY_TIMEOUT: - vc->do_io_close(); - // fixme - // handle timeout events - break; - default: - ink_release_assert(!"unknown event"); - } - return EVENT_CONT; - } - - int - handle_write(int event, Event *e) - { - switch (event) { - case VC_EVENT_WRITE_READY: - break; - - case VC_EVENT_WRITE_COMPLETE: - case VC_EVENT_EOS: - case VC_EVENT_ERROR: - case VC_EVENT_INACTIVITY_TIMEOUT: - vc->do_io_close(); - delete this; - return EVENT_DONE; - break; - default: - ink_release_assert(!"unknown event"); - } - return EVENT_CONT; - } -}; - -struct NetTesterAccept : public Continuation { - NetTesterAccept(ProxyMutex *_mutex) : Continuation(_mutex) { SET_HANDLER(&NetTesterAccept::handle_accept); } - int - handle_accept(int event, void *data) - { - Debug("net_test", "Accepted a connection"); - fflush(stdout); - NetVConnection *vc = (NetVConnection *)data; - new NetTesterSM(new_ProxyMutex(), vc); - return EVENT_CONT; - } -}; - -struct Stop : public Continuation { - Action *a; - Stop(ProxyMutex *m) : Continuation(m) { SET_HANDLER(&Stop::stop); } - int - stop(int event, Event *e) - { - a->cancel(); - return EVENT_DONE; - } -}; - -int -test_main() -{ - const char *response_hdr = "HTTP/1.0 200 OK\n" - "Content-Type: text/html\n" - "Content-Length: 8000\r\n\r\n"; - - resp_blk = new_IOBufferBlock(); - resp_blk->alloc(6); - char *b = resp_blk->start(); - ink_strlcpy(b, response_hdr, resp_blk->block_size()); - memset(b + strlen(response_hdr), 'x', 8000); - resp_blk->fill(doc_len = strlen(response_hdr) + 8000); - - Action *a = sslNetProcessor.accept(new NetTesterAccept(new_ProxyMutex()), 8080, true); - - return 0; -} -- To stop receiving notification emails like this one, please contact bc...@apache.org.