From 2c7cd2e83ce0d27650ec7316b51cfcd7f152da4c Mon Sep 17 00:00:00 2001 From: Maple Date: Thu, 31 Jul 2025 14:40:21 +0200 Subject: [PATCH 1/3] fix memory leak --- macros/src/protos.rs | 7 +------ src/nex/matchmake.rs | 4 +++- src/nex/user.rs | 6 ++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/macros/src/protos.rs b/macros/src/protos.rs index 14ec2f6..fdf8b62 100644 --- a/macros/src/protos.rs +++ b/macros/src/protos.rs @@ -325,10 +325,5 @@ impl ToTokens for RmcProtocolData{ self.generate_raw_trait(tokens); self.generate_raw_info(tokens); self.generate_raw_remote_trait(tokens); - - - - } -} - +} \ No newline at end of file diff --git a/src/nex/matchmake.rs b/src/nex/matchmake.rs index bba55f5..c01c9a7 100644 --- a/src/nex/matchmake.rs +++ b/src/nex/matchmake.rs @@ -50,7 +50,7 @@ impl MatchmakeManager{ async fn garbage_collect(&self){ info!("running rnex garbage collector over all sessions and users"); - let idx = 0; + let mut idx = 0; let mut to_be_deleted_gids = Vec::new(); @@ -69,6 +69,8 @@ impl MatchmakeManager{ if !session.is_reachable(){ to_be_deleted_gids.push(gid); } + + idx += 1; } let mut sessions = self.sessions.write().await; diff --git a/src/nex/user.rs b/src/nex/user.rs index e166a80..d77c289 100644 --- a/src/nex/user.rs +++ b/src/nex/user.rs @@ -269,6 +269,12 @@ impl MatchmakeExtension for User { let session = self.matchmake_manager.get_session(join_session_param.gid).await?; let mut session = session.lock().await; + + if session.session.user_password_enabled{ + if join_session_param.user_password != session.session.user_password{ + return Err(ErrorCode::RendezVous_InvalidPassword) + } + } session.connected_players.retain(|v| v.upgrade().is_some_and(|v| v.pid != self.pid)); From 2629151a04d2a3360b27c4bc2800b2522ed73f0e Mon Sep 17 00:00:00 2001 From: Maple Date: Wed, 5 Nov 2025 20:27:30 +0100 Subject: [PATCH 2/3] update dockerfile --- Dockerfile | 26 ++++++++++++++++++++------ src/grpc/account.rs | 17 ----------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74f7efd..5d32b23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,12 +9,26 @@ RUN apk add --no-cache protobuf-dev git musl-dev lld openssl-dev openssl-libs-st RUN git submodule update --init --recursive RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C relocation-model=static -C linker=ld.lld" cargo test --target x86_64-unknown-linux-musl -RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C relocation-model=static -C linker=ld.lld" cargo build --profile prod --target x86_64-unknown-linux-musl +RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C relocation-model=static -C linker=ld.lld" cargo build --profile prod --target x86_64-unknown-linux-musl # -FROM scratch AS final +FROM scratch AS node-holder +COPY --from=builder /app/target/x86_64-unknown-linux-musl/prod/edge_node_holder_server /edge_node_holder_server +ENTRYPOINT ["/edge_node_holder_server"] -# Copy the compiled binary from the builder stage -COPY --from=builder /app/target/x86_64-unknown-linux-musl/prod/splatoon-server-rust /splatoon-server-rust -# Command to run the application -ENTRYPOINT ["/splatoon-server-rust"] +FROM scratch AS proxy-insecure-v1 +COPY --from=builder /app/target/x86_64-unknown-linux-musl/prod/proxy_insecure /proxy_insecure +ENTRYPOINT ["/proxy_insecure"] + +FROM scratch AS proxy-secure-v1 +COPY --from=builder /app/target/x86_64-unknown-linux-musl/prod/proxy_secure /proxy_secure +ENTRYPOINT ["/proxy_secure"] + + +FROM scratch AS backend-auth +COPY --from=builder /app/target/x86_64-unknown-linux-musl/prod/backend_server_insecure /backend_server_insecure +ENTRYPOINT ["/backend_server_secure"] + +FROM scratch AS backend-secure +COPY --from=builder /app/target/x86_64-unknown-linux-musl/prod/backend_server_secure /backend_server_secure +ENTRYPOINT ["/backend_server_secure"] diff --git a/src/grpc/account.rs b/src/grpc/account.rs index d369501..f8ce0f6 100644 --- a/src/grpc/account.rs +++ b/src/grpc/account.rs @@ -137,20 +137,3 @@ impl Client{ } } */ -#[cfg(test)] -mod test{ - use crate::grpc::account::Client; - - #[tokio::test] - async fn test(){ - dotenv::dotenv().ok(); - - let mut client = Client::new().await.unwrap(); - - let cli = client.get_nex_password(1699562916).await.unwrap(); - - println!("{:?}", cli); - } - - -} \ No newline at end of file From 45990c890d12812e3a1893b177c073cb8e25aaec Mon Sep 17 00:00:00 2001 From: Maple Date: Wed, 5 Nov 2025 21:17:04 +0100 Subject: [PATCH 3/3] fix ci --- .gitlab-ci.yml | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 56c6940..02de8a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,19 +1,28 @@ -image: docker:latest +default: + image: quay.io/podman/stable variables: - IMAGE_NAME: "ci.perditum.com/perditum/rnex-splatoon" + DOCKER_TLS_CERTDIR: "/certs" IMAGE_TAG: "${CI_COMMIT_REF_SLUG}" -before_script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" ci.perditum.com - stages: - - build-and-push + - test + - build-and-push-image + - push-retagged-branch + - push-retagged-latest -build-and-push: - stage: build-and-push +build-and-push-image: + stage: build-and-push-image script: - - docker build -t "$IMAGE_NAME:$IMAGE_TAG" . - - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$IMAGE_NAME:latest" - - docker push "$IMAGE_NAME:$IMAGE_TAG" - - docker push "$IMAGE_NAME:latest" + - git submodule update --init + - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - podman build -t "$CI_REGISTRY_IMAGE/node-holder:$CI_COMMIT_SHORT_SHA" --target=node-holder . + - podman build -t "$CI_REGISTRY_IMAGE/proxy-secure-v1:$CI_COMMIT_SHORT_SHA" --target=proxy-secure-v1 . + - podman build -t "$CI_REGISTRY_IMAGE/proxy-insecure-v1:$CI_COMMIT_SHORT_SHA" --target=proxy-insecure-v1 . + - podman build -t "$CI_REGISTRY_IMAGE/backend-auth:$CI_COMMIT_SHORT_SHA" --target=backend-auth . + - podman build -t "$CI_REGISTRY_IMAGE/backend-secure:$CI_COMMIT_SHORT_SHA" --target=backend-secure . + - podman push "$CI_REGISTRY_IMAGE/node-holder:$CI_COMMIT_SHORT_SHA" + - podman push "$CI_REGISTRY_IMAGE/proxy-secure-v1:$CI_COMMIT_SHORT_SHA" + - podman push "$CI_REGISTRY_IMAGE/proxy-insecure-v1:$CI_COMMIT_SHORT_SHA" + - podman push "$CI_REGISTRY_IMAGE/backend-auth:$CI_COMMIT_SHORT_SHA" + - podman push "$CI_REGISTRY_IMAGE/backend-secure:$CI_COMMIT_SHORT_SHA" \ No newline at end of file