Skip to content

Commit

Permalink
CI: Export executable
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Oct 13, 2024
1 parent 533357c commit 018ee7c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v5
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ jobs:
- run: cargo test --verbose
build_release:
name: Build project in release
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
toolchain:
- stable

Expand All @@ -65,6 +66,11 @@ jobs:
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}

- run: cargo build --verbose --release
- name: Export executable
uses: actions/upload-artifact@v4
with:
name: pumpkin-${{ matrix.os }}
path: target/${{ matrix.target }}/release/pumpkin*
clippy_release:
name: Run lints in release mode
runs-on: ubuntu-latest
Expand All @@ -77,5 +83,5 @@ jobs:
- uses: actions/checkout@v4

- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo clippy --release --all-targets --all-features --no-default-features -- -D warnings

- run: cargo clippy --release --all-targets --all-features --no-default-features -- -D warnings
2 changes: 1 addition & 1 deletion pumpkin/src/client/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct GameProfile {
/// 2. Mojang's servers verify the client's credentials and add the player to the their Servers
/// 3. Now our server will send a Request to the Session servers and check if the Player has joined the Session Server .
///
/// **Note:** This process helps prevent unauthorized access to the server and ensures that only legitimate Minecraft accounts can connect.
/// See <https://snowiiii.github.io/Pumpkin/developer/authentication.html>
pub async fn authenticate(
username: &str,
server_hash: &str,
Expand Down
15 changes: 6 additions & 9 deletions pumpkin/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,22 +362,19 @@ impl Client {
/// Close connection when an error occurs or when the Client closed the connection
pub async fn poll(&self, event: &Event) {
if event.is_readable() {
let mut received_data = vec![0; 4096];
let mut bytes_read = 0;
let mut received_data = vec![];
let mut buf = [0; 4096];
loop {
let connection = self.connection.clone();
let mut connection = connection.lock();
match connection.read(&mut received_data[bytes_read..]) {
match connection.read(&mut buf) {
Ok(0) => {
// Reading 0 bytes means the other side has closed the
// connection or is done writing, then so are we.
self.close();
break;
}
Ok(n) => {
bytes_read += n;
received_data.extend(&vec![0; n]);
}
Ok(n) => received_data.extend(&buf[..n]),
// Would block "errors" are the OS's way of saying that the
// connection is not actually ready to perform this I/O operation.
Err(ref err) if would_block(err) => break,
Expand All @@ -387,9 +384,9 @@ impl Client {
}
}

if bytes_read != 0 {
if received_data.len() != 0 {
let mut dec = self.dec.lock();
dec.queue_slice(&received_data[..bytes_read]);
dec.queue_slice(&received_data);
match dec.decode() {
Ok(packet) => {
if let Some(packet) = packet {
Expand Down

0 comments on commit 018ee7c

Please sign in to comment.