/confdConfig/capi/connectTimeout (xs:duration) [PT60S]

Hi
Can you further explain the /confdConfig/cli/multiPatternOperation and /confdConfig/capi/objectCacheTimeout in confd guide?

Tt is better to take an example

Thanks

$ cat confd.conf | grep "<multiPatternOperation>"
    <multiPatternOperation>any</multiPatternOperation>
$ show arp arpe | select published false | select permanent false
Address         Interface   HW Address         Permant  Published
=================================================================
10.0.0.1        ethernet  - 0:50:59:85:1c:28   false    true     
10.0.0.2        ethernet  - 0:50:59:85:1c:30   false    true     
192.168.0.2     gignet    - 0:51:59:85:1c:30   false    true
$ cat confd.conf | grep "<multiPatternOperation>"
    <multiPatternOperation>all</multiPatternOperation>
$ show arp arpe | select published false | select permanent false
Address         Interface   HW Address         Permant  Published
=================================================================
% 0 entries in the table.

Register data provider with for example a get_next_object() callback that return a large list. Set the objectCacheTimeout to something “small”. Do some parsing of the returned list like in the CLI select example above. If the object cache timeout, the remaining values to be filtered will be fetched again by ConfD from the data provider.

Connect a socket to the ConfD IPC port without calling cdb_connect(). Wait until the timeout expires. The socket is disconnected by ConfD.

Hi
Thank you very much for your answer!
I am still have some doubt about the result, according to your answer, i use function of “connect()” to connect confd, code as below:


#include <stdlib.h>
#include <sys/types.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <time.h>
int main()
{
    time_t t;
    int cfd;
    int recbytes;
    int sin_size;
    char buffer[1024]= {0};
    struct sockaddr_in s_add,c_add;
    unsigned short portnum=4565;

    printf("Hello,welcome to client !\r\n");

    cfd = socket(PF_INET, SOCK_STREAM, 0);
    if(-1 == cfd) 
    {
        printf("socket fail ! \r\n");
        return -1;
    }
    printf("socket ok !\r\n");

    bzero(&s_add,sizeof(struct sockaddr_in));
    s_add.sin_family=AF_INET;
    s_add.sin_addr.s_addr= inet_addr("127.0.0.1");
    s_add.sin_port=htons(portnum);
    printf("s_addr = %#x ,port : %#x\r\n",s_add.sin_addr.s_addr,s_add.sin_port);

    if(-1 == connect(cfd,(struct sockaddr *)(&s_add), sizeof(struct sockaddr)))
    {
        printf("connect fail !\r\n");
        return -1;
    }

    printf("connect ok !\r\n");
    time(&t);
    printf("%s",ctime(&t));

    if(-1 == (recbytes = read(cfd,buffer,1024)))
    {
        printf("read data fail !\r\n");
        return -1;
    }

    time(&t);
    printf("%s",ctime(&t));

    printf("read ok\r\nREC:\r\n");

    buffer[recbytes]='\0';
    printf("read len[%d]: %s\r\n",recbytes,buffer);

    getchar();
    close(cfd);
    return 0;
}

run the code, result as below: the connect only last five seconds, and then disconnected whenever the value of “/confdConfig/capi/connectTimeout” is set.

[root@-]# gcc -o client client.c
[root@-]# ./client
Hello,welcome to client !
socket ok !
s_addr = 0x100007f ,port : 0xd511
connect ok !
Wed Feb  7 15:11:20 2018
Wed Feb  7 15:11:25 2018
read ok
REC:
read len[0]: 

we can also capture package , found: The socket is disconnected by ConfD after five seconds .

Question: My experiment is correct or not ? Why the “/confdConfig/capi/connectTimeout” does no take effect?

Thanks

Check your Linux TCP socket connect timeout etc. Maybe you have a firewall blocking the communication?

Actually there are several timeouts coming into play. confd_connect(CONTROL_SOCKET) will, after the socket connect(2) completes, a) tell the ConfD IPC port server “I want to talk to the DP-API component” (a.k.a. “capi”), and b) tell the DP-API component “This is the control socket for a daemon called xxxx”. There is a hardwired 5 second timeout when the IPC port server waits for a), and the connectTimeout is applied when the DP-API component waits for b). Bottom line, there is very little point in doing anything at all with the connectTimeout setting.