struct pollfd pfd;
struct hostent *server_hostent;
struct sockaddr_in server_addr;
+ struct sockaddr_in client_addr;
int n;
int plen = 0;
const char *ads;
libwebsocket_set_timeout(wsi,
PENDING_TIMEOUT_AWAITING_CONNECT_RESPONSE,
AWAITING_TIMEOUT);
+
+ bzero((char *) &client_addr, sizeof(client_addr));
+ client_addr.sin_family = AF_INET;
+
+ if (context->iface != NULL) {
+ if (interface_to_sa(context->iface, &client_addr,
+ sizeof(client_addr)) < 0) {
+ lwsl_err("Unable to find interface %s\n", context->iface);
+ compatible_close(wsi->sock);
+ goto failed;
+ }
+
+ if (bind(wsi->sock, (struct sockaddr *) &client_addr,
+ sizeof(client_addr)) < 0) {
+ lwsl_err("Error binding to interface %s", context->iface);
+ compatible_close(wsi->sock);
+ goto failed;
+ }
+ }
}
server_addr.sin_family = AF_INET;
context->http_proxy_port = 0;
context->http_proxy_address[0] = '\0';
context->options = info->options;
+ context->iface = info->iface;
/* to reduce this allocation, */
context->max_fds = getdtablesize();
lwsl_notice(" static allocation: %u + (%u x %u fds) = %u bytes\n",