93 return SET_ERROR(err, ERR_CALLOC); |
93 return SET_ERROR(err, ERR_CALLOC); |
94 |
94 |
95 // initialize |
95 // initialize |
96 TAILQ_INIT(&net->channels); |
96 TAILQ_INIT(&net->channels); |
97 |
97 |
98 // XXX: over-simplified blocking connect |
98 if (info->raw_sock) { |
99 if (info->use_ssl) { |
99 log_info("connected using raw socket: %p", info->raw_sock); |
|
100 |
|
101 sock = info->raw_sock; |
|
102 |
|
103 } else if (info->use_ssl) { |
100 log_info("connecting to [%s]:%s using SSL", info->hostname, info->service); |
104 log_info("connecting to [%s]:%s using SSL", info->hostname, info->service); |
101 |
105 |
|
106 // XXX: over-simplified blocking connect |
102 if (sock_ssl_connect(&sock, info->hostname, info->service, err)) |
107 if (sock_ssl_connect(&sock, info->hostname, info->service, err)) |
103 goto error; |
108 goto error; |
104 |
109 |
105 } else { |
110 } else { |
106 log_info("connecting to [%s]:%s", info->hostname, info->service); |
111 log_info("connecting to [%s]:%s", info->hostname, info->service); |
107 |
112 |
|
113 // XXX: over-simplified blocking connect |
108 if (sock_tcp_connect(&sock, info->hostname, info->service, err)) |
114 if (sock_tcp_connect(&sock, info->hostname, info->service, err)) |
109 goto error; |
115 goto error; |
110 |
116 |
111 } |
117 } |
112 |
118 |