/*
SSSD
Socket utils
Copyright (C) Simo Sorce <ssorce@redhat.com> 2016
Copyright (C) Sumit Bose <sbose@redhat.com> 2009
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
{
int ret;
int cur_flags;
if (ret == -1) {
return ret;
}
if (ret == -1) {
return ret;
}
if (ret == -1) {
return ret;
}
if (ret == -1) {
return ret;
}
return EOK;
}
{
int ret;
/* SO_KEEPALIVE and TCP_NODELAY are set by OpenLDAP client libraries but
* failures are ignored.*/
if (ret != 0) {
"setsockopt SO_KEEPALIVE failed.[%d][%s].\n", ret,
}
if (ret != 0) {
"setsockopt TCP_NODELAY failed.[%d][%s].\n", ret,
}
return EOK;
}
struct sssd_async_connect_state {
int fd;
};
void *priv);
struct tevent_context *ev,
int fd,
{
int ret;
struct sssd_async_connect_state);
return NULL;
}
goto done;
}
switch (ret) {
case EINPROGRESS:
case EINTR:
/* Despite the connect() man page says waiting on a non-blocking
* connect should be done by checking for writability, we need to check
* also for readability.
* With TEVENT_FD_READ, connect fails much faster in offline mode with
* errno 113/No route to host.
*/
goto done;
}
return req;
default:
}
done:
} else {
}
return req;
}
void *priv)
{
int ret;
errno = 0;
if (ret == -1) {
return; /* Try again later */
}
}
} else {
}
}
{
return EOK;
}
struct tevent_timer *te,
{
}
struct sssd_async_socket_state {
int sd;
};
static int sssd_async_socket_state_destructor(void *data);
struct tevent_context *ev,
struct sockaddr_storage *addr,
{
int ret;
return NULL;
}
goto fail;
}
goto fail;
}
goto fail;
}
goto fail;
}
"Setting %d seconds timeout for connecting\n", timeout);
subreq);
goto fail;
}
return req;
fail:
return req;
}
{
int ret;
/* kill the timeout handler now that we got a reply */
"sdap_async_sys_connect request failed: [%d]: %s.\n",
goto fail;
}
return;
fail:
}
{
/* steal the sd and neutralize destructor actions */
return EOK;
}
{
}
return 0;
}