pub struct GameplaySocket {
    socket: UdpSocket,
    peer_refresh_times: HashMap<PeerIdentifier, Instant>,
    peer_addrs: HashMap<PeerIdentifier, SocketAddr>,
    peer_queues: HashMap<PeerIdentifier, MessageOrderer<ServerAction, ClientAction>>,
}
Expand description

Sends effects and receives actions over UDP.

Fields

socket: UdpSocketpeer_refresh_times: HashMap<PeerIdentifier, Instant>peer_addrs: HashMap<PeerIdentifier, SocketAddr>peer_queues: HashMap<PeerIdentifier, MessageOrderer<ServerAction, ClientAction>>

Implementations

Binds a UdpSocket to 0.0.0.0:7812 to start listening for messages and sets up initial state.

Used by the LoginServer, adds a new peer identifier to listen for, and their associated encryption key.

Sends and receives all pending messages on the UDP socket.

Returns queued messages as long as there are any. These are queued up by GameplaySocket::transport.

Disconnects clients that haven’t been refreshed in a while, returns all of the current peers.

Queues up the action to the peer, for sending during the next GameplaySocket::transport.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.