indigo-astronomy / indigo

INDIGO is a system of standards and frameworks for multiplatform and distributed astronomy software development designed to scale with your needs.
http://www.indigo-astronomy.org
Other
139 stars 64 forks source link

LX200_Mount opens a bogus SkyFi connection to a nonexistent server #456

Closed je-lamiaud closed 1 year ago

je-lamiaud commented 1 year ago

When a "lx200://" type connection is requested while the lx200 TCP server is not yet up, the indigo_mount_lx200 reports having open the connection. Of course, not any action on the mount succeeds, as there is no real connection. I had this problem both on Linux and MacOS.

The cause is _opensocket reporting a valid socket value, event though this socket connection failed. Please find below a patch which fixed the issue for me:

--- a/indigo_libs/indigo_io.c
+++ b/indigo_libs/indigo_io.c
@@ -265,6 +265,7 @@ static int open_socket(const char *host, int port, int type) {
                }
                indigo_error("Can't connect socket (%s)", strerror(errno));
                close(handle);
+               handle = -1;
        }
        freeaddrinfo(address_list);
        return handle;