CI: Export executable

This commit is contained in:
Snowiiii 2024-10-13 18:57:13 +02:00
parent 533357ceaa
commit 018ee7c583
4 changed files with 17 additions and 14 deletions

View File

@ -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

View File

@ -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
@ -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

View File

@ -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,

View File

@ -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,
@ -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 {