vppinfra: explicit blocking mode for sock connects
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3a33230de13fef613dc9523cf24a9968d200c2e5
This commit is contained in:

committed by
Dave Wallace

parent
46cb4c4094
commit
57e0af924b
@ -583,7 +583,8 @@ memif_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
|
|||||||
{
|
{
|
||||||
clib_memset (sock, 0, sizeof(clib_socket_t));
|
clib_memset (sock, 0, sizeof(clib_socket_t));
|
||||||
sock->config = (char *) msf->filename;
|
sock->config = (char *) msf->filename;
|
||||||
sock->flags = CLIB_SOCKET_F_IS_CLIENT| CLIB_SOCKET_F_SEQPACKET;
|
sock->flags = CLIB_SOCKET_F_IS_CLIENT | CLIB_SOCKET_F_SEQPACKET |
|
||||||
|
CLIB_SOCKET_F_BLOCKING;
|
||||||
|
|
||||||
if ((err = clib_socket_init (sock)))
|
if ((err = clib_socket_init (sock)))
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,8 @@ vcl_api_connect_app_socket (vcl_worker_t * wrk)
|
|||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
cs->config = (char *) vcm->cfg.vpp_app_socket_api;
|
cs->config = (char *) vcm->cfg.vpp_app_socket_api;
|
||||||
cs->flags = CLIB_SOCKET_F_IS_CLIENT | CLIB_SOCKET_F_SEQPACKET;
|
cs->flags =
|
||||||
|
CLIB_SOCKET_F_IS_CLIENT | CLIB_SOCKET_F_SEQPACKET | CLIB_SOCKET_F_BLOCKING;
|
||||||
|
|
||||||
wrk->vcl_needs_real_epoll = 1;
|
wrk->vcl_needs_real_epoll = 1;
|
||||||
|
|
||||||
|
@ -518,8 +518,10 @@ clib_socket_init (clib_socket_t * s)
|
|||||||
s->fd, s->config);
|
s->fd, s->config);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Connect was blocking so set fd to non-blocking now */
|
/* Connect was blocking so set fd to non-blocking now unless
|
||||||
|
* blocking mode explicitly requested. */
|
||||||
if (!(s->flags & CLIB_SOCKET_F_NON_BLOCKING_CONNECT) &&
|
if (!(s->flags & CLIB_SOCKET_F_NON_BLOCKING_CONNECT) &&
|
||||||
|
!(s->flags & CLIB_SOCKET_F_BLOCKING) &&
|
||||||
fcntl (s->fd, F_SETFL, O_NONBLOCK) < 0)
|
fcntl (s->fd, F_SETFL, O_NONBLOCK) < 0)
|
||||||
{
|
{
|
||||||
error = clib_error_return_unix (0, "fcntl NONBLOCK2 (fd %d, '%s')",
|
error = clib_error_return_unix (0, "fcntl NONBLOCK2 (fd %d, '%s')",
|
||||||
|
@ -62,7 +62,7 @@ typedef struct _socket_t
|
|||||||
#define CLIB_SOCKET_F_ALLOW_GROUP_WRITE (1 << 4)
|
#define CLIB_SOCKET_F_ALLOW_GROUP_WRITE (1 << 4)
|
||||||
#define CLIB_SOCKET_F_SEQPACKET (1 << 5)
|
#define CLIB_SOCKET_F_SEQPACKET (1 << 5)
|
||||||
#define CLIB_SOCKET_F_PASSCRED (1 << 6)
|
#define CLIB_SOCKET_F_PASSCRED (1 << 6)
|
||||||
|
#define CLIB_SOCKET_F_BLOCKING (1 << 7)
|
||||||
|
|
||||||
/* Transmit buffer. Holds data waiting to be written. */
|
/* Transmit buffer. Holds data waiting to be written. */
|
||||||
u8 *tx_buffer;
|
u8 *tx_buffer;
|
||||||
|
Reference in New Issue
Block a user