aboutsummaryrefslogtreecommitdiff
path: root/src/IO
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-05-17 03:00:04 +0200
committerjcid <devnull@localhost>2008-05-17 03:00:04 +0200
commit907df0d21b68efd17f176d883a5d857d571237c6 (patch)
treec975f8b5721cd0902c9dab07177b2ce7e664826b /src/IO
parent42a48c329bdaa79d3a92951912f1174b7bc5035c (diff)
- CCC: added reentrancy control to the OpEnd and OpAbort operations.
- CCC: enhanced the debug function and implemented OpAbort for dpi.
Diffstat (limited to 'src/IO')
-rw-r--r--src/IO/IO.c9
-rw-r--r--src/IO/dpi.c7
-rw-r--r--src/IO/http.c2
3 files changed, 11 insertions, 7 deletions
diff --git a/src/IO/IO.c b/src/IO/IO.c
index f87f32e0..db3239a6 100644
--- a/src/IO/IO.c
+++ b/src/IO/IO.c
@@ -137,7 +137,7 @@ static void IO_close_fd(IOData_t *io, int CloseCode)
int st;
int events = 0;
- _MSG("====> begin IO close (%d) Key=%d CloseCode=%d Flags=%d ",
+ _MSG("====> begin IO_close_fd (%d) Key=%d CloseCode=%d Flags=%d ",
io->FD, io->Key, CloseCode, io->Flags);
/* With HTTP, if we close the writing part, the reading one also gets
@@ -157,11 +157,9 @@ static void IO_close_fd(IOData_t *io, int CloseCode)
if (CloseCode & IO_StopRd) {
events |= DIO_READ;
}
-
if (CloseCode & IO_StopWr) {
events |= DIO_WRITE;
}
-
a_IOwatch_remove_fd(io->FD, events);
_MSG(" end IO close (%d) <=====\n", io->FD);
}
@@ -213,6 +211,7 @@ static bool_t IO_read(IOData_t *io)
* may abort the whole Chain. */
if ((io = IO_get(io_key))) {
/* All data read (EOF) */
+ _MSG("IO_read: io->Key=%d io_key=%d\n", io->Key, io_key);
a_IO_ccc(OpEnd, 2, FWD, io->Info, io, NULL);
}
}
@@ -349,7 +348,7 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
IOData_t *io;
DataBuf *dbuf;
- a_Chain_debug_msg("a_IO_ccc", Op, Branch, Dir);
+ dReturn_if_fail( a_Chain_check("a_IO_ccc", Op, Branch, Dir, Info) );
if (Branch == 1) {
if (Dir == BCK) {
@@ -421,7 +420,7 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
break;
case OpEnd:
a_Chain_fcb(OpEnd, Info, NULL, NULL);
- IO_close_fd(io, IO_StopRdWr);
+ IO_close_fd(io, IO_StopRdWr); /* IO_StopRd would leak FDs */
IO_free(io);
dFree(Info);
break;
diff --git a/src/IO/dpi.c b/src/IO/dpi.c
index 52ee7d87..33e5f730 100644
--- a/src/IO/dpi.c
+++ b/src/IO/dpi.c
@@ -606,7 +606,7 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
dpi_conn_t *conn;
int SockFD = -1, st;
- a_Chain_debug_msg("a_Dpi_ccc", Op, Branch, Dir);
+ dReturn_if_fail( a_Chain_check("a_Dpi_ccc", Op, Branch, Dir, Info) );
if (Branch == 1) {
if (Dir == BCK) {
@@ -641,6 +641,11 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
dFree(Info->LocalKey);
dFree(Info);
break;
+ case OpAbort:
+ a_Chain_bcb(OpAbort, Info, NULL, NULL);
+ dFree(Info->LocalKey);
+ dFree(Info);
+ break;
default:
MSG_WARN("Unused CCC\n");
break;
diff --git a/src/IO/http.c b/src/IO/http.c
index 46a2f313..6275db3d 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -498,7 +498,7 @@ void a_Http_ccc(int Op, int Branch, int Dir, ChainLink *Info,
{
int SKey = VOIDP2INT(Info->LocalKey);
- a_Chain_debug_msg("a_Http_ccc", Op, Branch, Dir);
+ dReturn_if_fail( a_Chain_check("a_Http_ccc", Op, Branch, Dir, Info) );
if (Branch == 1) {
if (Dir == BCK) {