Skip to content

Commit

Permalink
decrement
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-cho committed Jun 9, 2024
1 parent d5e84e9 commit 2dd3289
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
images: |
ghcr.io/${{ github.repository_owner }}/tcp-echoserver
tags: |
type=raw,value=latest
type=raw,value=decrement
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ For personal test.

Return based on input

- number: return number + 1
- number: return number - 1
- etc: return itself

### env
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::env;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;

// 숫자면 +1
// 숫자면 -1
// 글자면 그대로
#[tokio::main]
async fn main() {
Expand All @@ -27,7 +27,7 @@ async fn main() {
match std::str::from_utf8(&buf[..n]) {
Ok(received_str) => {
if let Ok(num) = received_str.trim().parse::<i32>() {
let response = (num + 1).to_string();
let response = (num - 1).to_string();
socket.write_all(response.as_bytes()).await.unwrap();
} else {
socket.write_all(received_str.as_bytes()).await.unwrap();
Expand Down

0 comments on commit 2dd3289

Please sign in to comment.