Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c192c9ec96 | ||
|
|
86f6fca703 | ||
|
|
bbe744a323 | ||
|
|
3d401fbc8d | ||
|
|
a0c9d31389 | ||
|
|
48ea80bb8f |
@@ -1,6 +1,30 @@
|
||||
# Changelog
|
||||
All changes to this project will be documented in this file.
|
||||
|
||||
## [8.0.6] - 2020-01-31
|
||||
|
||||
(snake) add an option to disable answering pongs as response to pings, to test cobra client behavior with hanged connections
|
||||
|
||||
## [8.0.5] - 2020-01-31
|
||||
|
||||
(IXCobraConnection) set a ping timeout of 90 seconds. If no pong messages are received as responses to ping for a while, give up and close the connection
|
||||
|
||||
## [8.0.4] - 2020-01-31
|
||||
|
||||
(cobra to sentry) remove noisy logging
|
||||
|
||||
## [8.0.3] - 2020-01-30
|
||||
|
||||
(ixcobra) check if we are authenticated in publishNext before trying to publish a message
|
||||
|
||||
## [8.0.2] - 2020-01-28
|
||||
|
||||
Extract severity level when emitting messages to sentry
|
||||
|
||||
## [8.0.1] - 2020-01-28
|
||||
|
||||
Fix bug #151 - If a socket connection is interrupted, calling stop() on the IXWebSocket object blocks until the next retry
|
||||
|
||||
## [8.0.0] - 2020-01-26
|
||||
|
||||
(SocketServer) add ability to bind on an ipv6 address
|
||||
|
||||
@@ -265,7 +265,15 @@ namespace ix
|
||||
_webSocket->setUrl(url);
|
||||
_webSocket->setPerMessageDeflateOptions(webSocketPerMessageDeflateOptions);
|
||||
_webSocket->setTLSOptions(socketTLSOptions);
|
||||
|
||||
// Send a websocket ping every N seconds (N = 30) now
|
||||
// This should keep the connection open and prevent some load balancers such as
|
||||
// the Amazon one from shutting it down
|
||||
_webSocket->setPingInterval(kPingIntervalSecs);
|
||||
|
||||
// If we don't receive a pong back, declare loss after 3 * N seconds
|
||||
// (will be 90s now), and close and restart the connection
|
||||
_webSocket->setPingTimeout(3 * kPingIntervalSecs);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -506,7 +514,7 @@ namespace ix
|
||||
if (_messageQueue.empty()) return true;
|
||||
|
||||
auto&& msg = _messageQueue.back();
|
||||
if (!publishMessage(msg))
|
||||
if (!_authenticated || !publishMessage(msg))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -166,6 +166,17 @@ namespace ix
|
||||
tags.append(tag);
|
||||
}
|
||||
}
|
||||
|
||||
if (msg["data"]["info"].isMember("level_str"))
|
||||
{
|
||||
// https://docs.sentry.io/enriching-error-data/context/?platform=python#setting-the-level
|
||||
std::string level = msg["data"]["info"]["level_str"].asString();
|
||||
if (level == "critical")
|
||||
{
|
||||
level = "fatal";
|
||||
}
|
||||
payload["level"] = level;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace snake
|
||||
|
||||
// Misc
|
||||
bool verbose;
|
||||
bool disablePong;
|
||||
};
|
||||
|
||||
bool isAppKeyValid(const AppConfig& appConfig, std::string appkey);
|
||||
|
||||
@@ -21,6 +21,15 @@ namespace snake
|
||||
, _server(appConfig.port, appConfig.hostname)
|
||||
{
|
||||
_server.setTLSOptions(appConfig.socketTLSOptions);
|
||||
|
||||
if (appConfig.disablePong)
|
||||
{
|
||||
_server.disablePong();
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "Listening on " << appConfig.hostname << ":" << appConfig.port;
|
||||
ix::IXCoreLogger::Log(ss.str().c_str());
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define IX_WEBSOCKET_VERSION "8.0.0"
|
||||
#define IX_WEBSOCKET_VERSION "8.0.5"
|
||||
|
||||
3
makefile
3
makefile
@@ -49,6 +49,9 @@ BUILD := ${NAME}:build
|
||||
print_version:
|
||||
@echo 'IXWebSocket version =>' ${TAG}
|
||||
|
||||
set_version:
|
||||
sh tools/update_version.sh ${VERSION}
|
||||
|
||||
docker_test:
|
||||
docker build -f docker/Dockerfile.debian -t bsergean/ixwebsocket_test:build .
|
||||
|
||||
|
||||
45
tools/update_version.sh
Executable file
45
tools/update_version.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#/bin/sh
|
||||
|
||||
ver_gt() {
|
||||
[ "$1" != "$2" ] && [ "$2" == "$(echo "$1\n$2" | sort -V | head -n1)" ]
|
||||
}
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
PROJECT_ROOT="$(dirname ${SCRIPT_DIR})"
|
||||
CUR_VSN=$(bash $SCRIPT_DIR/extract_version.sh)
|
||||
NEW_VSN="$1"
|
||||
|
||||
|
||||
check_ver() {
|
||||
if [[ $NEW_VSN =~ ^[0-9.]+$ ]]; then
|
||||
:
|
||||
else
|
||||
echo "Invalid version '$NEW_VSN'"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_ver_increase() {
|
||||
if ! ver_gt $NEW_VSN $CUR_VSN; then
|
||||
echo "Invalid version '$NEW_VSN'. Must be greater than current version $CUR_VSN"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_changelog() {
|
||||
if ! egrep "\b$NEW_VSN\b" $PROJECT_ROOT/docs/CHANGELOG.md >/dev/null; then
|
||||
echo "Invalid version '$NEW_VSN'. Missing entry in CHANGELOG.md"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
set_version() {
|
||||
sed -i '' "s/$CUR_VSN/$NEW_VSN/g" $PROJECT_ROOT/ixwebsocket/IXWebSocketVersion.h
|
||||
echo "Set version to '$NEW_VSN'"
|
||||
exit 0
|
||||
}
|
||||
|
||||
check_ver
|
||||
check_ver_increase
|
||||
check_changelog
|
||||
set_version
|
||||
@@ -99,6 +99,7 @@ int main(int argc, char** argv)
|
||||
bool redirect = false;
|
||||
bool version = false;
|
||||
bool verifyNone = false;
|
||||
bool disablePong = false;
|
||||
int port = 8008;
|
||||
int redisPort = 6379;
|
||||
int statsdPort = 8125;
|
||||
@@ -309,6 +310,7 @@ int main(int argc, char** argv)
|
||||
snakeApp->add_option("--apps_config_path", appsConfigPath, "Path to auth data")
|
||||
->check(CLI::ExistingPath);
|
||||
snakeApp->add_flag("-v", verbose, "Verbose");
|
||||
snakeApp->add_flag("-d", disablePong, "Disable Pongs");
|
||||
addTLSOptions(snakeApp);
|
||||
|
||||
CLI::App* httpServerApp = app.add_subcommand("httpd", "HTTP server");
|
||||
@@ -492,7 +494,8 @@ int main(int argc, char** argv)
|
||||
redisPassword,
|
||||
verbose,
|
||||
appsConfigPath,
|
||||
tlsOptions);
|
||||
tlsOptions,
|
||||
disablePong);
|
||||
}
|
||||
else if (app.got_subcommand("httpd"))
|
||||
{
|
||||
|
||||
3
ws/ws.h
3
ws/ws.h
@@ -142,7 +142,8 @@ namespace ix
|
||||
const std::string& redisPassword,
|
||||
bool verbose,
|
||||
const std::string& appsConfigPath,
|
||||
const ix::SocketTLSOptions& tlsOptions);
|
||||
const ix::SocketTLSOptions& tlsOptions,
|
||||
bool disablePong);
|
||||
|
||||
int ws_httpd_main(int port,
|
||||
const std::string& hostname,
|
||||
|
||||
@@ -58,8 +58,6 @@ namespace ix
|
||||
std::random_shuffle(games.begin(), games.end());
|
||||
std::string game = games[0];
|
||||
|
||||
spdlog::info("Sending event for game '{}'", game);
|
||||
|
||||
_condition.wait(lock, [this] { return !_stop; });
|
||||
|
||||
if (_queues[game].empty())
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace ix
|
||||
const std::string& redisPassword,
|
||||
bool verbose,
|
||||
const std::string& appsConfigPath,
|
||||
const SocketTLSOptions& socketTLSOptions)
|
||||
const SocketTLSOptions& socketTLSOptions,
|
||||
bool disablePong)
|
||||
{
|
||||
snake::AppConfig appConfig;
|
||||
appConfig.port = port;
|
||||
@@ -53,6 +54,7 @@ namespace ix
|
||||
appConfig.redisPort = redisPort;
|
||||
appConfig.redisPassword = redisPassword;
|
||||
appConfig.socketTLSOptions = socketTLSOptions;
|
||||
appConfig.disablePong = disablePong;
|
||||
|
||||
// Parse config file
|
||||
auto str = readAsString(appsConfigPath);
|
||||
|
||||
Reference in New Issue
Block a user