Merge pull request #904 from dnaka91/fix-int-type

server: Fix int type of batch execution enum
This commit is contained in:
tt2468 2022-02-13 14:41:45 -08:00 committed by GitHub
commit c64e360c2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <stdint.h>
namespace RequestBatchExecutionType {
enum RequestBatchExecutionType {
enum RequestBatchExecutionType: int8_t {
/**
* Not a request batch.
*
@ -77,7 +77,7 @@ namespace RequestBatchExecutionType {
Parallel = 2,
};
inline bool IsValid(int executionType)
inline bool IsValid(int8_t executionType)
{
return executionType >= None && executionType <= Parallel;
}

View File

@ -233,7 +233,7 @@ void WebSocketServer::ProcessMessage(SessionPtr session, WebSocketServer::Proces
return;
}
uint8_t requestedExecutionType = payloadData["executionType"];
int8_t requestedExecutionType = payloadData["executionType"];
if (!RequestBatchExecutionType::IsValid(requestedExecutionType) || requestedExecutionType == RequestBatchExecutionType::None) {
ret.closeCode = WebSocketCloseCode::InvalidDataFieldValue;
ret.closeReason = "Your `executionType` has an invalid value.";