const char *pRight;
if ((Buf == NULL) || (Buf->buf == NULL)) {
- StrBufCutAt(Buf, 0, Buf->buf);
return;
}
if (pRight != NULL) {
StrBufCutAt(Buf, 0, pRight);
}
- else {
- StrBufCutAt(Buf, 0, Buf->buf);
- return;
- }
pLeft = strrchr(ChrPtr(Buf), leftboundary);
if (pLeft != NULL) {
StrBufCutLeft(Buf, pLeft - Buf->buf + 1);
}
- else {
- StrBufCutAt(Buf, 0, Buf->buf);
- return;
- }
}
return StrLength(FB->Buf) - (FB->ReadWritePointer - FB->Buf->buf);
}
-void FDIOBufferInit(FDIOBuffer *FDB, IOBuffer *IO, int FD, long TotalSendSize)
+inline static void FDIOBufferFlush(FDIOBuffer *FDB)
{
memset(FDB, 0, sizeof(FDIOBuffer));
+ FDB->OtherFD = -1;
+ FDB->SplicePipe[0] = -1;
+ FDB->SplicePipe[1] = -1;
+}
+
+void FDIOBufferInit(FDIOBuffer *FDB, IOBuffer *IO, int FD, long TotalSendSize)
+{
+ FDIOBufferFlush(FDB);
FDB->ChunkSize =
FDB->TotalSendSize = TotalSendSize;
FDB->IOB = IO;
if (FDB->OtherFD > 0)
close(FDB->OtherFD);
- memset(FDB, 0, sizeof(FDIOBuffer));
+ FDIOBufferFlush(FDB);
}
int FileSendChunked(FDIOBuffer *FDB, const char **Err)