diff --git a/examples/hpclient/client.js b/examples/hpclient/client.js index 8638e99f..1d89a542 100644 --- a/examples/hpclient/client.js +++ b/examples/hpclient/client.js @@ -29,11 +29,11 @@ function main() { } - var server = 'ws://localhost:8080' + var server = 'wss://localhost:8080' - if (process.argv.length == 3) server = 'ws://localhost:' + process.argv[2] + if (process.argv.length == 3) server = 'wss://localhost:' + process.argv[2] - if (process.argv.length == 4) server = 'ws://' + process.argv[2] + ':' + process.argv[3] + if (process.argv.length == 4) server = 'wss://' + process.argv[2] + ':' + process.argv[3] var ws = new ws_api(server, { rejectUnauthorized: false diff --git a/src/comm/comm_session.hpp b/src/comm/comm_session.hpp index 21627a92..a7e42377 100644 --- a/src/comm/comm_session.hpp +++ b/src/comm/comm_session.hpp @@ -10,7 +10,7 @@ namespace comm /** * Set of flags used to mark status information on the session. - * usr and p2p subsystems makes use of this to mark status information of user and peer sessions. + * usr and p2p subsystems make use of this to mark status information of user and peer sessions. * Set flags are stored in 'flags' bitset of comm_session. */ enum SESSION_FLAG @@ -56,7 +56,7 @@ public: conf::ip_port_pair known_ipport; SESSION_STATE state; - // The set of SESSION_FLAG enum flags that will be set by user-code of this calss. + // The set of SESSION_FLAG enum flags that will be set by user-code of this class. // We mainly use this to store contexual information about this session based on the use case. // Setting and reading flags to this is completely managed by user-code. std::bitset<8> flags; diff --git a/src/jsonschema/usrmsg_helpers.cpp b/src/jsonschema/usrmsg_helpers.cpp index 42273f09..affc7c6d 100644 --- a/src/jsonschema/usrmsg_helpers.cpp +++ b/src/jsonschema/usrmsg_helpers.cpp @@ -38,8 +38,8 @@ const size_t CHALLENGE_LEN = 16; /** * Constructs user challenge message json and the challenge string required for - * initial user challenge handshake. This gets called when a user gets establishes - * a web sockets connection to HP. + * initial user challenge handshake. This gets called when a user establishes + * a web socket connection to HP. * * @param msg String reference to copy the generated json message string into. * Message format: @@ -64,7 +64,7 @@ void create_user_challenge(std::string &msg, std::string &challengehex) // Construct the challenge msg json. // We do not use RapidJson here in favour of performance because this is a simple json message. - // Since we know the rough size of the challenge massage we reserve adequate amount for the holder. + // Since we know the rough size of the challenge message we reserve adequate amount for the holder. // Only Hot Pocket version number is variable length. Therefore message size is roughly 90 bytes // so allocating 128bytes for heap padding. msg.reserve(128); @@ -305,7 +305,7 @@ int extract_signed_input_container( if (!d[FLD_CONTENT].IsString() || !d[FLD_SIG].IsString()) { - LOG_DBG << "User signed input invaid field values."; + LOG_DBG << "User signed input invalid field values."; return -1; } @@ -354,7 +354,7 @@ int extract_input_container(std::string &nonce, std::string &input, uint64_t &ma if (!d[FLD_NONCE].IsString() || !d[FLD_INPUT].IsString() || !d[FLD_MAX_LED_SEQ].IsUint64()) { - LOG_DBG << "User input container invaid field values."; + LOG_DBG << "User input container invalid field values."; return -1; } diff --git a/src/proc.hpp b/src/proc.hpp index 6f03faf7..b92e2c41 100644 --- a/src/proc.hpp +++ b/src/proc.hpp @@ -12,15 +12,16 @@ namespace proc { /** - * Represents list of inputs to the contract and the accumilated contract output for those inputs. + * Represents list of inputs to the contract and the accumulated contract output for those inputs. */ struct contract_iobuf_pair { // List of inputs to be fed into the contract. std::list inputs; - // Output emitted by contract after execution. (Because we are reading output at the end, there's no way to - // get a "list" of outputs. So it's always a one contingous output.) + // Output emitted by contract after execution. + // (Because we are reading output at the end, there's no way to + // get a "list" of outputs. So it's always a one contiguous output.) std::string output; }; diff --git a/src/statefs/state_monitor/state_monitor.cpp b/src/statefs/state_monitor/state_monitor.cpp index 06673061..228ae9b8 100644 --- a/src/statefs/state_monitor/state_monitor.cpp +++ b/src/statefs/state_monitor/state_monitor.cpp @@ -29,10 +29,10 @@ void state_monitor::create_checkpoint() /** * Checkpoints are numbered 0, -1, -2, ... * Checkpoint 0 is the latest state containing "state", "data", "delta", "bhmap", "htree" directories. - * Checkpoints -1 and lower cotnains only the "delta" dirs containing older state changesets. + * Checkpoints -1 and lower contains only the "delta" dirs containing older state changesets. */ - // Shift "-1" and older checkpoints by 1 more. And then copy checkpoint 0 delta dir to "-1" + // Shift "-1" and older checkpoints by 1 more. And then copy checkpoint 0 delta dir to "-1". // If MAX oldest checkpoint is there, remove it and work our way upwards. int16_t oldest_chkpnt = MAX_CHECKPOINTS * -1; for (int16_t chkpnt = oldest_chkpnt; chkpnt <= -1; chkpnt++) @@ -113,7 +113,7 @@ void state_monitor::onopen(const int inodefd, const int flags) */ void state_monitor::onwrite(const int fd, const off_t offset, const size_t length) { - // TODO: Known issue: Onwrite can get called if the client program deletes a file before + // TODO: Known issue: onwrite can get called if the client program deletes a file before // closing the currently open file. If there were some bytes on the write buffer, the flush happens // when the client closes the fd. By that time the fd is invalid since the file is deleted. // However nothing happens to us as our code simply returns on invalild fd error. @@ -244,8 +244,8 @@ int state_monitor::get_fd_filepath(std::string &filepath, const int fd) void state_monitor::oncreate_filepath(const std::string &filepath) { // Check whether we are already tracking this file path. - // Only way we could be tracking this patth already is deleting an existing file and creating - // a new file with same name. + // Only way we could be tracking this path already is deleting an existing file and creating + // a new file with the same name. if (file_info_map.count(filepath) == 0) { // Add an entry for the new file in the file info map. This information will be used to ignore diff --git a/src/usr/user_session_handler.cpp b/src/usr/user_session_handler.cpp index 7cb0c6c2..2227324b 100644 --- a/src/usr/user_session_handler.cpp +++ b/src/usr/user_session_handler.cpp @@ -24,7 +24,7 @@ int user_session_handler::on_connect(comm::comm_session &session) const LOG_DBG << "User client connected " << session.uniqueid; // As soon as a user connects, we issue them a challenge message. We remember the - // challenge we issued and later verifies the user's response with it. + // challenge we issued and later verify the user's response with it. std::string msgstr; jusrmsg::create_user_challenge(msgstr, session.issued_challenge); session.send(msgstr); @@ -41,7 +41,7 @@ int user_session_handler::on_connect(comm::comm_session &session) const int user_session_handler::on_message(comm::comm_session &session, std::string_view message) const { // First check whether this session is pending challenge. - // Meaning we have previously issued a challenge to the client, + // Meaning we have previously issued a challenge to the client. if (session.flags[comm::SESSION_FLAG::USER_CHALLENGE_ISSUED]) { if (verify_challenge(message, session) == 0) diff --git a/src/usr/usr.cpp b/src/usr/usr.cpp index feaab35e..72c7c7d6 100644 --- a/src/usr/usr.cpp +++ b/src/usr/usr.cpp @@ -69,7 +69,7 @@ int verify_challenge(std::string_view message, comm::comm_session &session) std::string_view original_challenge = session.issued_challenge; if (jusrmsg::verify_user_challenge_response(userpubkeyhex, message, original_challenge) == 0) { - // Challenge singature verification successful. + // Challenge signature verification successful. // Decode hex pubkey and get binary pubkey. We are only going to keep // the binary pubkey due to reduced memory footprint. @@ -80,7 +80,7 @@ int verify_challenge(std::string_view message, comm::comm_session &session) userpubkey.length(), userpubkeyhex); - // Now check whether this user public key is duplicate. + // Now check whether this user public key is a duplicate. if (ctx.sessionids.count(userpubkey) == 0) { // All good. Unique public key. diff --git a/src/util.cpp b/src/util.cpp index 91fce1ff..ed442d9f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -180,7 +180,7 @@ int version_compare(const std::string &x, const std::string &y) /** * Returns a std::string_view pointing to the rapidjson Value which is assumed - * to be a string. We use this function because rapidjson does not have build-in string_view + * to be a string. We use this function because rapidjson does not have built-in string_view * support. Passing a non-string 'v' is not supported. */ std::string_view getsv(const rapidjson::Value &v)