Fix a few warnings
This commit is contained in:
+1
-1
@@ -121,7 +121,7 @@ protected:
|
|||||||
int written = us_socket_write(SSL, (us_socket_t *) this, asyncSocketData->buffer.data(), asyncSocketData->buffer.length(), /*nextLength != 0 | */length);
|
int written = us_socket_write(SSL, (us_socket_t *) this, asyncSocketData->buffer.data(), asyncSocketData->buffer.length(), /*nextLength != 0 | */length);
|
||||||
|
|
||||||
/* On failure return, otherwise continue down the function */
|
/* On failure return, otherwise continue down the function */
|
||||||
if (written < asyncSocketData->buffer.length()) {
|
if ((unsigned int) written < asyncSocketData->buffer.length()) {
|
||||||
|
|
||||||
/* Update buffering (todo: we can do better here if we keep track of what happens to this guy later on) */
|
/* Update buffering (todo: we can do better here if we keep track of what happens to this guy later on) */
|
||||||
asyncSocketData->buffer = asyncSocketData->buffer.substr(written);
|
asyncSocketData->buffer = asyncSocketData->buffer.substr(written);
|
||||||
|
|||||||
+2
-2
@@ -236,7 +236,7 @@ private:
|
|||||||
AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) httpContextData->upgradedWebSocket;
|
AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) httpContextData->upgradedWebSocket;
|
||||||
|
|
||||||
/* Uncork here as well (note: what if we failed to uncork and we then pub/sub before we even upgraded?) */
|
/* Uncork here as well (note: what if we failed to uncork and we then pub/sub before we even upgraded?) */
|
||||||
auto [written, failed] = asyncSocket->uncork();
|
/*auto [written, failed] = */asyncSocket->uncork();
|
||||||
|
|
||||||
/* Reset upgradedWebSocket before we return */
|
/* Reset upgradedWebSocket before we return */
|
||||||
httpContextData->upgradedWebSocket = nullptr;
|
httpContextData->upgradedWebSocket = nullptr;
|
||||||
@@ -276,7 +276,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Drain any socket buffer, this might empty our backpressure and thus finish the request */
|
/* Drain any socket buffer, this might empty our backpressure and thus finish the request */
|
||||||
auto [written, failed] = asyncSocket->write(nullptr, 0, true, 0);
|
/*auto [written, failed] = */asyncSocket->write(nullptr, 0, true, 0);
|
||||||
|
|
||||||
/* Expect another writable event, or another request within the timeout */
|
/* Expect another writable event, or another request within the timeout */
|
||||||
asyncSocket->timeout(HTTP_IDLE_TIMEOUT_S);
|
asyncSocket->timeout(HTTP_IDLE_TIMEOUT_S);
|
||||||
|
|||||||
+7
-7
@@ -104,7 +104,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string_view getQuery() {
|
std::string_view getQuery() {
|
||||||
if (querySeparator < headers->value.length()) {
|
if (querySeparator < (int) headers->value.length()) {
|
||||||
/* Strip the initial ? */
|
/* Strip the initial ? */
|
||||||
return std::string_view(headers->value.data() + querySeparator + 1, headers->value.length() - querySeparator - 1);
|
return std::string_view(headers->value.data() + querySeparator + 1, headers->value.length() - querySeparator - 1);
|
||||||
} else {
|
} else {
|
||||||
@@ -117,7 +117,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string_view getParameter(unsigned int index) {
|
std::string_view getParameter(unsigned int index) {
|
||||||
if (currentParameters.first < index) {
|
if (currentParameters.first < (int) index) {
|
||||||
return {};
|
return {};
|
||||||
} else {
|
} else {
|
||||||
return currentParameters.second[index];
|
return currentParameters.second[index];
|
||||||
@@ -239,8 +239,8 @@ public:
|
|||||||
|
|
||||||
// this is exactly the same as below!
|
// this is exactly the same as below!
|
||||||
// todo: refactor this
|
// todo: refactor this
|
||||||
if (remainingStreamingBytes >= length) {
|
if (remainingStreamingBytes >= (unsigned int) length) {
|
||||||
void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == length);
|
void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == (unsigned int) length);
|
||||||
remainingStreamingBytes -= length;
|
remainingStreamingBytes -= length;
|
||||||
return returnedUser;
|
return returnedUser;
|
||||||
} else {
|
} else {
|
||||||
@@ -280,8 +280,8 @@ public:
|
|||||||
|
|
||||||
if (remainingStreamingBytes) {
|
if (remainingStreamingBytes) {
|
||||||
// this is exactly the same as above!
|
// this is exactly the same as above!
|
||||||
if (remainingStreamingBytes >= length) {
|
if (remainingStreamingBytes >= (unsigned int) length) {
|
||||||
void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == length);
|
void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == (unsigned int) length);
|
||||||
remainingStreamingBytes -= length;
|
remainingStreamingBytes -= length;
|
||||||
return returnedUser;
|
return returnedUser;
|
||||||
} else {
|
} else {
|
||||||
@@ -317,7 +317,7 @@ public:
|
|||||||
length -= consumed.first;
|
length -= consumed.first;
|
||||||
|
|
||||||
if (length) {
|
if (length) {
|
||||||
if (length < MAX_FALLBACK_SIZE) {
|
if ((unsigned int) length < MAX_FALLBACK_SIZE) {
|
||||||
fallback.append(data, length);
|
fallback.append(data, length);
|
||||||
} else {
|
} else {
|
||||||
return errorHandler(user);
|
return errorHandler(user);
|
||||||
|
|||||||
+2
-2
@@ -77,7 +77,7 @@ private:
|
|||||||
|
|
||||||
/* Called only once per request */
|
/* Called only once per request */
|
||||||
void writeMark() {
|
void writeMark() {
|
||||||
writeHeader("uWebSockets", "v0.16");
|
writeHeader("uWebSockets", "v0.17");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns true on success, indicating that it might be feasible to write more data.
|
/* Returns true on success, indicating that it might be feasible to write more data.
|
||||||
@@ -142,7 +142,7 @@ private:
|
|||||||
httpResponseData->offset += written;
|
httpResponseData->offset += written;
|
||||||
|
|
||||||
/* Success is when we wrote the entire thing without any failures */
|
/* Success is when we wrote the entire thing without any failures */
|
||||||
bool success = written == data.length() && !failed;
|
bool success = (unsigned int) written == data.length() && !failed;
|
||||||
|
|
||||||
/* If we are now at the end, start a timeout. Also start a timeout if we failed. */
|
/* If we are now at the end, start a timeout. Also start a timeout if we failed. */
|
||||||
if (!success || httpResponseData->offset == totalSize) {
|
if (!success || httpResponseData->offset == totalSize) {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ struct WebSocketContextData {
|
|||||||
/* Note: this assumes we are not corked, as corking will swallow things and fail later on */
|
/* Note: this assumes we are not corked, as corking will swallow things and fail later on */
|
||||||
|
|
||||||
/* Check if we now have too much backpressure (todo: don't buffer up before check) */
|
/* Check if we now have too much backpressure (todo: don't buffer up before check) */
|
||||||
if (asyncSocket->getBufferedAmount() > maxBackpressure) {
|
if ((unsigned int) asyncSocket->getBufferedAmount() > maxBackpressure) {
|
||||||
asyncSocket->close();
|
asyncSocket->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user