Commit 1b565856 authored by Alex Hultman's avatar Alex Hultman

Pass testListening, testReusePort & partially testHTTP

parent fac23e65
......@@ -132,6 +132,8 @@ Group<isServer>::Group(int extensionOptions, uS::Loop *loop) : extensionOptions(
template <bool isServer>
void Group<isServer>::stopListening() {
uS::Context::stopListening();
// stop context
// if (async) {
......
......@@ -64,6 +64,8 @@ uS::Socket *HttpSocket<isServer>::onData(uS::Socket *s, char *data, size_t lengt
httpSocket->missedDeadline = false;
if (httpSocket->contentLength >= length) {
Group<isServer>::from(httpSocket)->httpDataHandler(httpSocket->outstandingResponsesTail, data, length, httpSocket->contentLength -= length);
// not worth corking?
httpSocket->cork(false);
return httpSocket;
} else {
Group<isServer>::from(httpSocket)->httpDataHandler(httpSocket->outstandingResponsesTail, data, httpSocket->contentLength, 0);
......@@ -149,11 +151,14 @@ uS::Socket *HttpSocket<isServer>::onData(uS::Socket *s, char *data, size_t lengt
Group<SERVER>::from(httpSocket)->httpRequestHandler(res, req, nullptr, 0, 0);
}
// fix this! corking should happen even if is shutting down!
if (httpSocket->isClosed() || httpSocket->isShuttingDown()) {
// should uncokr here to release any shutdown sends
return httpSocket;
}
} else {
httpSocket->onEnd(httpSocket);
httpSocket->cork(false); // added recently
return httpSocket;
}
}
......@@ -181,6 +186,7 @@ uS::Socket *HttpSocket<isServer>::onData(uS::Socket *s, char *data, size_t lengt
} else {
httpSocket->onEnd(httpSocket);
}
httpSocket->cork(false); // added recently
return httpSocket;
}
} else {
......@@ -191,6 +197,7 @@ uS::Socket *HttpSocket<isServer>::onData(uS::Socket *s, char *data, size_t lengt
httpSocket->httpBuffer.append(lastCursor, end - lastCursor);
}
}
httpSocket->cork(false); // added recently
return httpSocket;
}
} while(cursor != end);
......
......@@ -234,6 +234,17 @@ struct HttpResponse {
while (messagePtr) {
HttpSocket<true>::Queue::Message *nextMessage = messagePtr->nextMessage;
std::cout << "OUT OF ORDER RESPONSE IS COMMENTED OUT!" << std::endl;
// delete this message
HttpSocket<true>::freeMessage(messagePtr);
// messagePtr->callback = callback;
// messagePtr->callbackData = callbackData;
// if (httpSocket->sendMessage(messagePtr, true)) {
// HttpSocket<true>::freeMessage(messagePtr);
// }
// bool wasTransferred;
// if (httpSocket->write(messagePtr, wasTransferred)) {
// if (!wasTransferred) {
......@@ -252,7 +263,7 @@ struct HttpResponse {
// }
// goto updateHead;
// }
// messagePtr = nextMessage;
messagePtr = nextMessage;
}
// cannot go beyond unfinished responses
if (!head->hasEnded) {
......
This diff is collapsed.
Subproject commit b28c3c6317b4b9ffb2bf1c36268e4f20de74e9cf
Subproject commit f4fe1118eaa52ba8f97120c85441bb33fb90e3b6
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment