Explorar el Código

Merge pull request #19397 from Faless/ws_get_ip_port

Fix LWSPeer get_connected_[host/port]
Max Hilbrunner hace 7 años
padre
commit
aaf93f92d8
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      modules/websocket/lws_peer.cpp

+ 2 - 2
modules/websocket/lws_peer.cpp

@@ -191,8 +191,8 @@ IP_Address LWSPeer::get_connected_host() const {
 	IP_Address ip;
 	int port = 0;
 
-	socklen_t len = 0;
 	struct sockaddr_storage addr;
+	socklen_t len = sizeof(addr);
 
 	int fd = lws_get_socket_fd(wsi);
 	ERR_FAIL_COND_V(fd == -1, IP_Address());
@@ -212,8 +212,8 @@ uint16_t LWSPeer::get_connected_port() const {
 	IP_Address ip;
 	int port = 0;
 
-	socklen_t len = 0;
 	struct sockaddr_storage addr;
+	socklen_t len = sizeof(addr);
 
 	int fd = lws_get_socket_fd(wsi);
 	ERR_FAIL_COND_V(fd == -1, 0);