You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2016/05/11 16:41:14 UTC
[trafficserver] branch master updated: TS-4433: Handle
TSVConnFdCreate failure in the intercept example.
This is an automated email from the ASF dual-hosted git repository.
jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new a6e8332 TS-4433: Handle TSVConnFdCreate failure in the intercept example.
a6e8332 is described below
commit a6e833285b46ce0292db46466695446cba5d0caf
Author: Oknet <xu...@gmail.com>
AuthorDate: Tue May 10 22:20:32 2016 +0800
TS-4433: Handle TSVConnFdCreate failure in the intercept example.
This closes #626.
---
example/intercept/intercept.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/example/intercept/intercept.cc b/example/intercept/intercept.cc
index e36351d..8da626e 100644
--- a/example/intercept/intercept.cc
+++ b/example/intercept/intercept.cc
@@ -311,7 +311,18 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void *edata)
delete istate;
TSContDestroy(contp);
- close(fd);
+ ::close(fd);
+ return TS_EVENT_NONE;
+ }
+
+ if ((istate->server.vc = TSVConnFdCreate(fd)) == NULL) {
+ VDEBUG("TSVconnFdCreate() failed");
+ TSVConnAbort(arg.vc, TS_VC_CLOSE_ABORT);
+
+ delete istate;
+ TSContDestroy(contp);
+
+ ::close(fd);
return TS_EVENT_NONE;
}
@@ -320,7 +331,6 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void *edata)
istate->txn = cdata.txn;
istate->client.vc = arg.vc;
- istate->server.vc = TSVConnFdCreate(fd);
// Reset the continuation data to be our intercept state
// block. We will need this so that we can access both of the
@@ -372,7 +382,6 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void *edata)
TSVConn vc = TSVIOVConnGet(arg.vio);
InterceptIO *from = InterceptGetThisSide(cdata.istate, vc);
InterceptIO *to = InterceptGetOtherSide(cdata.istate, vc);
- ;
int64_t nbytes;
VIODEBUG(arg.vio, "ndone=%" PRId64 " ntodo=%" PRId64, TSVIONDoneGet(arg.vio), TSVIONTodoGet(arg.vio));
@@ -419,7 +428,6 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void *edata)
TSVConn vc = TSVIOVConnGet(arg.vio);
InterceptIO *to = InterceptGetThisSide(cdata.istate, vc);
InterceptIO *from = InterceptGetOtherSide(cdata.istate, vc);
- ;
// If the other side is closed, close this side too, but only if there
// we have drained the write buffer.
@@ -450,7 +458,6 @@ InterceptInterceptionHook(TSCont contp, TSEvent event, void *edata)
InterceptIO *from = InterceptGetThisSide(cdata.istate, vc);
InterceptIO *to = InterceptGetOtherSide(cdata.istate, vc);
- ;
VIODEBUG(arg.vio, "received EOS or ERROR from %s side", InterceptProxySideVC(cdata.istate, vc));
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].