Code

release v0.29
[ncmpc.git] / src / aconnect.c
index 345bc52c8f5e1dde1738c54448883d579031dffb..82085edb06b419dada29e158d3af92bb96bbd9e5 100644 (file)
@@ -40,7 +40,6 @@
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
-#include <sys/socket.h>
 
 struct aconnect {
        const struct aconnect_handler *handler;
@@ -108,7 +107,6 @@ static void
 aconnect_rconnect_success(int fd, void *ctx)
 {
        struct aconnect *ac = ctx;
-       assert(ac->rconnect != NULL);
        ac->rconnect = NULL;
 
        ac->fd = fd;
@@ -123,7 +121,6 @@ static void
 aconnect_rconnect_error(const char *message, void *ctx)
 {
        struct aconnect *ac = ctx;
-       assert(ac->rconnect != NULL);
        ac->rconnect = NULL;
 
        ac->handler->error(message, ac->handler_ctx);
@@ -144,10 +141,10 @@ aconnect_start(struct aconnect **acp,
        ac->handler = handler;
        ac->handler_ctx = ctx;
 
+       *acp = ac;
+
        async_rconnect_start(&ac->rconnect, host, port,
                             &aconnect_rconnect_handler, ac);
-
-       *acp = ac;
 }
 
 void