Explorar o código

[cpp] Allow host ip of 0, if name is '0.0.0.0' closes #5987

Hugh %!s(int64=8) %!d(string=hai) anos
pai
achega
d4640c563a
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      std/cpp/_std/sys/net/Socket.hx

+ 2 - 2
std/cpp/_std/sys/net/Socket.hx

@@ -153,7 +153,7 @@ class Socket {
 
    public function connect(host : Host, port : Int) : Void {
       try {
-         if (host.ip==0) {
+         if (host.ip==0 && host.host!="0.0.0.0") {
             // hack, hack, hack
             var ipv6:haxe.io.BytesData = Reflect.field(host,"ipv6");
             if (ipv6!=null)
@@ -189,7 +189,7 @@ class Socket {
    }
 
    public function bind(host : Host, port : Int) : Void {
-      if (host.ip==0)
+      if (host.ip==0  && host.host!="0.0.0.0")
       {
           var ipv6:haxe.io.BytesData = Reflect.field(host,"ipv6");
           if (ipv6!=null)