Implement get_peer_[address|port] in ENet/WSServer

Also implement get_connected_host and get_connected_port in WebSocketPeer
(not supported in HTML5 due to browser limitation).
Add shorthand disconnect_peer(id) for get_peer(id)->close() like in ENet to
WebSocketServer.
This commit is contained in:
Fabio Alessandrelli
2018-04-10 17:52:10 +02:00
parent 23fc8ca223
commit 6b9ec810c6
11 changed files with 121 additions and 5 deletions

View File

@ -52,6 +52,10 @@ public:
virtual bool is_server() const;
ConnectionStatus get_connection_status() const;
virtual IP_Address get_peer_address(int p_peer_id) const = 0;
virtual int get_peer_port(int p_peer_id) const = 0;
virtual void disconnect_peer(int p_peer_id) = 0;
void _on_peer_packet(int32_t p_peer_id);
void _on_connect(int32_t p_peer_id, String p_protocol);
void _on_disconnect(int32_t p_peer_id);