602 |
|
return 0; |
603 |
|
} |
604 |
|
|
605 |
< |
/* Make sure this server isn't already connected |
606 |
< |
* Note: conf should ALWAYS be a valid C: line |
605 |
> |
/* |
606 |
> |
* Make sure this server isn't already connected. |
607 |
> |
* Note: conf should ALWAYS be a valid connect {} block |
608 |
|
*/ |
609 |
|
if ((client_p = hash_find_server(conf->name))) |
610 |
|
{ |
630 |
|
/* We already converted the ip once, so lets use it - stu */ |
631 |
|
strlcpy(client_p->sockhost, buf, sizeof(client_p->sockhost)); |
632 |
|
|
633 |
< |
/* create a socket for the server connection */ |
633 |
> |
/* Create a socket for the server connection */ |
634 |
|
if (comm_open(&client_p->connection->fd, conf->addr.ss.ss_family, SOCK_STREAM, 0, NULL) < 0) |
635 |
|
{ |
636 |
|
/* Eek, failure to create the socket */ |
641 |
|
return 0; |
642 |
|
} |
643 |
|
|
644 |
< |
/* servernames are always guaranteed under HOSTLEN chars */ |
644 |
> |
/* Server names are always guaranteed under HOSTLEN chars */ |
645 |
|
fd_note(&client_p->connection->fd, "Server: %s", client_p->name); |
646 |
|
|
647 |
< |
/* Attach config entries to client here rather than in |
648 |
< |
* serv_connect_callback(). This to avoid null pointer references. |
647 |
> |
/* |
648 |
> |
* Attach config entries to client here rather than in serv_connect_callback(). |
649 |
> |
* This to avoid null pointer references. |
650 |
|
*/ |
651 |
|
if (!attach_connect_block(client_p, conf->name, conf->host)) |
652 |
|
{ |
661 |
|
return 0; |
662 |
|
} |
663 |
|
|
664 |
< |
/* at this point we have a connection in progress and C/N lines |
665 |
< |
* attached to the client, the socket info should be saved in the |
666 |
< |
* client and it should either be resolved or have a valid address. |
664 |
> |
/* |
665 |
> |
* At this point we have a connection in progress and a connect {} block |
666 |
> |
* attached to the client, the socket info should be saved in the client |
667 |
> |
* and it should either be resolved or have a valid address. |
668 |
|
* |
669 |
|
* The socket has been connected or connect is in progress. |
670 |
|
*/ |