Skip to content

Commit

Permalink
Change NetConnectionEnd to be closer to steamworks ESteamNetConnectio…
Browse files Browse the repository at this point in the history
…nEnd
  • Loading branch information
simonstix committed Feb 23, 2024
1 parent cb36794 commit 7b05c2a
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 95 deletions.
3 changes: 2 additions & 1 deletion src/networking_sockets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::sync::Arc;
use sys::SteamNetworkingMessage_t;

use steamworks_sys as sys;
use crate::networking_types::AppNetConnectionEnd;

/// Access to the steam networking sockets interface
pub struct NetworkingSockets<Manager> {
Expand Down Expand Up @@ -948,7 +949,7 @@ impl<Manager> Drop for NetConnection<Manager> {
sys::SteamAPI_ISteamNetworkingSockets_CloseConnection(
self.sockets,
self.handle,
NetConnectionEnd::AppGeneric.into(),
NetConnectionEnd::App(AppNetConnectionEnd::generic_normal()).into(),
debug_string.as_ptr(),
false,
)
Expand Down
6 changes: 2 additions & 4 deletions src/networking_sockets_callback.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use crate::networking_sockets::NetConnection;
use crate::networking_types::{
NetConnectionEnd, NetConnectionStatusChanged, NetworkingConnectionState,
};
use crate::networking_types::{AppNetConnectionEnd, NetConnectionEnd, NetConnectionStatusChanged, NetworkingConnectionState};
use crate::{register_callback, CallbackHandle, Inner};
use std::sync::{Arc, Weak};
use steamworks_sys as sys;
Expand Down Expand Up @@ -83,7 +81,7 @@ impl<Manager: 'static> ConnectionCallbackHandler<Manager> {
fn reject_connection(&self, connection_handle: sys::HSteamNetConnection) {
if let Some(inner) = self.inner.upgrade() {
NetConnection::new_internal(connection_handle, self.sockets, inner.clone()).close(
NetConnectionEnd::AppGeneric,
NetConnectionEnd::App(AppNetConnectionEnd::generic_normal()).into(),
Some("no new connections will be accepted"),
false,
);
Expand Down
Loading

0 comments on commit 7b05c2a

Please sign in to comment.