Changeset 18097 for trunk/FACT++


Ignore:
Timestamp:
01/29/15 09:05:02 (10 years ago)
Author:
tbretz
Message:
Updated to v20r13
Location:
trunk/FACT++/dim
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/dim/README_v20.txt

    r18058 r18097  
    11
    2                     DIM version 20r11 Release Notes
     2                    DIM version 20r13 Release Notes
    33
    44Notes 1 and 2 for Unix Users only
     
    1717                Dns </dev/null >& dns.log &
    1818
    19 NOTE 3: The Version Number service provided by servers is now set to 2011.
     19NOTE 3: The Version Number service provided by servers is now set to 2013.
     20
     2122/01/2014
     22Changes for version 2013:
     23    - Tried to improve in the DNS the handling of many connections at startup
     24      (and many applications "simultaneous" restart)
     25
     26
     2703/12/2014
     28Changes for version 2012:
     29    - In Linux the number of connections is now completely dynamic.
     30      (replaced select by poll)
     31    - Changed the default SEND and RECV buffer sizes per connection from 16Kb to 64Kb
     32      (except for the DNS connections: 32 Kb, to limit the memory increase)
     33    - Changed the DNS Keepalive timeout from 15 to 20 seconds (to use a little less CPU)
     34
    2035
    213624/10/2014
  • trunk/FACT++/dim/dim/dim.h

    r18058 r18097  
    1414#include "dim_common.h"
    1515
    16 #define DIM_VERSION_NUMBER 2011
     16#define DIM_VERSION_NUMBER 2013
    1717
    1818
     
    163163#define MAX_CONNS               1024
    164164#define ID_BLOCK                512
    165 #define TCP_RCV_BUF_SIZE        16384/*32768*//*65536*/
    166 #define TCP_SND_BUF_SIZE        16384/*32768*//*65536*/
     165#define TCP_RCV_BUF_SIZE        /*16384*//*32768*/65536
     166#define TCP_SND_BUF_SIZE        /*16384*//*32768*/65536
    167167#endif
    168168#define DID_DNS_TMOUT_MIN       5
  • trunk/FACT++/dim/src/dns.c

    r18058 r18097  
    395395                                        {
    396396                                                dim_print_date_time();
    397 printf(" Service %s already declared by conn %d - %s@%s:%d (PID %d), Redeclared by conn %d - %s@%s:%d (PID %d)(same server) - Closing old conn %d\n",
     397printf(" Service %s already declared by conn %d - %s@%s:%d (PID %d), Redeclared by conn %d - %s@%s:%d (PID %d)(same server) - Closing both conns %d %d\n",
    398398                                                        servp->serv_name, servp->conn_id,
    399399                                                        Dns_conns[servp->conn_id].task_name,
     
    406406                                                        Dns_conns[conn_id].port,
    407407                                                        Dns_conns[conn_id].pid,
    408                                                         servp->conn_id);
     408                                                        servp->conn_id, conn_id);
    409409                                                fflush(stdout);
    410410                                                release_conn(servp->conn_id);
     411                                                release_conn(conn_id);
     412/*
    411413                                                update_did = 0;
    412 /*
     414*/
    413415                                                return(0);
    414 */
     416
    415417                                        }
    416418                                        else
     
    10791081        void service_remove();
    10801082
    1081         if( Dns_conns[conn_id].src_type == SRC_DIS )
     1083        servp = (DNS_SERVICE *)Dns_conns[conn_id].service_head;
     1084        nodep = (NODE *)Dns_conns[conn_id].node_head;
     1085        if(( Dns_conns[conn_id].src_type == SRC_DIS ) || (servp))
    10821086        {
    10831087                if( Debug )
     
    11431147                dna_close(conn_id);
    11441148        }
    1145         else if(Dns_conns[conn_id].src_type == SRC_DIC)
     1149        else if((Dns_conns[conn_id].src_type == SRC_DIC) || (nodep))
    11461150        {
    11471151                if(Debug)
     
    14351439        dim_set_write_timeout(10);
    14361440        dim_set_listen_backlog(1024);
     1441        dim_set_keepalive_timeout(90);
     1442        dim_set_write_buffer_size(32768);
     1443        dim_set_read_buffer_size(32768);
    14371444        dim_init();
    14381445        conn_arr_create( SRC_DNS );
  • trunk/FACT++/dim/src/tcpip.c

    r18058 r18097  
    1414*/
    1515
    16 /* Modifies the number of open connections to 8192 for Windows and Linux */
    17 /* Can not be moved from here ! */
    18 #include <dim_tcpip.h>
    19 
    2016#ifdef WIN32
     17#define FD_SETSIZE      16384
     18#define poll(pfd,nfds,timeout)  WSAPoll(pfd,nfds,timeout)
    2119#define ioctl ioctlsocket
    2220
     
    7068#endif
    7169
     70#ifdef __linux__
     71#include <poll.h>
     72#define MY_FD_ZERO(set)
     73#define MY_FD_SET(fd, set)              poll_add(fd)
     74#define MY_FD_CLR(fd, set)
     75#define MY_FD_ISSET(fd, set)    poll_test(fd)
     76#else
     77#define MY_FD_ZERO(set)                 FD_ZERO(set)
     78#define MY_FD_SET(fd, set)              FD_SET(fd, set)
     79#define MY_FD_CLR(fd, set)              FD_CLR(fd, set)
     80#define MY_FD_ISSET(fd, set)    FD_ISSET(fd, set)
     81#endif
     82
    7283#include <stdio.h>
    7384#include <time.h>
     
    123134        {
    124135                ret = get_keepalive_tmout();
     136                Keepalive_timeout_set = ret;
    125137        }
    126138        return(ret);
     
    470482*/
    471483
     484#ifdef __linux__
     485static struct pollfd *Pollfds = 0;
     486static int Pollfd_size = 0;
     487
     488static int poll_create()
     489{
     490        int i;
     491        if(Pollfd_size == 0)
     492        {
     493                Pollfd_size = Curr_N_Conns;
     494                Pollfds = malloc(Pollfd_size * sizeof(struct pollfd));
     495                Pollfds[0].fd = -1;
     496                for(i = 0; i < Pollfd_size; i++)
     497                {
     498                        Pollfds[i].events = POLLIN;
     499                }
     500        }
     501        else if(Pollfd_size < Curr_N_Conns)
     502        {
     503                free(Pollfds);
     504                Pollfd_size = Curr_N_Conns;
     505                Pollfds = malloc(Pollfd_size * sizeof(struct pollfd));
     506                Pollfds[0].fd = -1;
     507                for(i = 0; i < Pollfd_size; i++)
     508                {
     509                        Pollfds[i].events = POLLIN;
     510                }
     511        }
     512        return 1;
     513}
     514
     515static int poll_add(int fd)
     516{
     517        Pollfds[0].fd = fd;
     518        return 1;
     519}
     520
     521static int poll_test(int fd)
     522{
     523        if(Pollfds[0].fd == fd)
     524        {
     525                if( (Pollfds[0].revents & POLLIN) || (Pollfds[0].revents & POLLHUP) )
     526                {
     527                    Pollfds[0].revents = 0;
     528                        return 1;
     529                }
     530        }
     531        return 0;
     532}
     533#endif
     534
    472535static int list_to_fds( fd_set *fds )
    473536{
     
    475538        int found = 0;
    476539
     540        DISABLE_AST
     541#ifdef __linux__
     542        if(fds) {}
     543        poll_create();
     544#else
    477545        FD_ZERO( fds ) ;
     546#endif
    478547        for( i = 1; i < Curr_N_Conns; i++ )
    479548    {
     549#ifdef __linux__
     550                Pollfds[i].fd = -1;
     551#endif
    480552                if( Dna_conns[i].busy )
    481553                {
     
    483555                        {
    484556                                found = 1;
     557#ifdef __linux__
     558                                Pollfds[i].fd = Net_conns[i].channel;
     559#else
    485560                                FD_SET( Net_conns[i].channel, fds );
     561#endif
    486562
    487563                        }
    488564                }
    489565        }
     566        ENABLE_AST
    490567        return(found);
    491568}
     
    495572        int     i;
    496573
     574#ifdef __linux__
     575        int index = *conn_id;
     576        if(fds) {}
     577        index++;
     578        for( i = index; i < Pollfd_size; i++ )
     579        {
     580                if( Dna_conns[i].busy && (
     581                    (Pollfds[i].revents & POLLIN) || (Pollfds[i].revents & POLLHUP) ) )
     582                {
     583                    Pollfds[i].revents = 0;
     584                    if(Net_conns[i].channel)
     585                    {
     586                                *conn_id = i;
     587                                return 1;
     588                        }
     589                }
     590        }
     591        return 0;
     592#else
    497593        for( i = 1; i < Curr_N_Conns; i++ )
    498594        {
     
    508604        }
    509605        return 0;
     606#endif
    510607}
    511608
     
    724821                timeout.tv_usec = 0;
    725822                list_to_fds( &rfds );
     823#ifdef __linux__
     824                selret = poll(Pollfds, Pollfd_size, 0);
     825#else
    726826                selret = select(FD_SETSIZE, &rfds, NULL, NULL, &timeout);
     827#endif
    727828                if(selret > 0)
    728829                {
     830                        conn_id = 0;
    729831                        while( (ret = fds_get_entry( &rfds, &conn_id )) > 0 )
    730832                        {
     
    749851                                        do_accept( conn_id );
    750852                                }
    751                                 FD_CLR( (unsigned)Net_conns[conn_id].channel, &rfds );
     853                                MY_FD_CLR( (unsigned)Net_conns[conn_id].channel, &rfds );
    752854                }
    753855                }
     
    760862         * call the right routine to handle the situation.
    761863         */
    762         fd_set  rfds, efds, *pfds;
     864        fd_set  rfds, *pfds;
     865#ifndef __linux__
     866        fd_set efds;
     867#endif
    763868        int     conn_id, ret, count;
    764869#ifndef WIN32
     
    772877
    773878                list_to_fds( &rfds );
    774                 FD_ZERO(&efds);
     879                MY_FD_ZERO(&efds);
    775880#ifdef WIN32
    776881                pfds = &efds;
     
    778883                pfds = &rfds;
    779884#endif
    780                 FD_SET( DIM_IO_path[0], pfds );
     885                MY_FD_SET( DIM_IO_path[0], pfds );
     886#ifdef __linux__
     887                ret = poll(Pollfds, Pollfd_size, -1);
     888#else
    781889                ret = select(FD_SETSIZE, &rfds, NULL, &efds, NULL);
     890#endif
     891                if(ret <= 0)
     892                  {
     893                    printf("poll returned %d, errno %d\n", ret, errno);
     894                  }
    782895                if(ret > 0)
    783896                {
    784                         if(FD_ISSET(DIM_IO_path[0], pfds) )
     897                        if(MY_FD_ISSET(DIM_IO_path[0], pfds) )
    785898                        {
    786899#ifndef WIN32
     
    788901                                DIM_IO_Done = 0;
    789902#endif
    790                                 FD_CLR( (unsigned)DIM_IO_path[0], pfds );
     903                                MY_FD_CLR( (unsigned)DIM_IO_path[0], pfds );
    791904                        }
    792905/*
     
    794907                        DISABLE_AST
    795908*/
     909                        conn_id = 0;
    796910                        while( (ret = fds_get_entry( &rfds, &conn_id )) > 0 )
    797911                        {
     
    820934                                        ENABLE_AST
    821935                                }
    822                                 FD_CLR( (unsigned)Net_conns[conn_id].channel, &rfds );
     936                                MY_FD_CLR( (unsigned)Net_conns[conn_id].channel, &rfds );
    823937                        }
    824938/*
     
    12841398                Net_conns[conn_id].read_rout( conn_id, -1, 0 );
    12851399*/
     1400                dna_report_error(conn_id, 0,
     1401                        "Writing (blocking) to", DIM_ERROR, DIMTCPWRRTY);
    12861402                return(0);
    12871403        }
     
    13221438         */
    13231439        int     wrote, ret, selret;
    1324 
     1440        int tcpip_would_block();
     1441#ifdef __linux__
     1442        struct pollfd pollitem;
     1443#else
    13251444        struct timeval  timeout;
    13261445        fd_set wfds;
    1327         int tcpip_would_block();
     1446#endif
    13281447       
    13291448        set_non_blocking(Net_conns[conn_id].channel);
     
    13521471                if(tcpip_would_block(ret))
    13531472                {
     1473#ifdef __linux__
     1474                  pollitem.fd = Net_conns[conn_id].channel;
     1475                  pollitem.events = POLLOUT;
     1476                  pollitem.revents = 0;
     1477                  selret = poll(&pollitem, 1, Write_timeout*1000);
     1478#else
    13541479                        timeout.tv_sec = Write_timeout;
    13551480                        timeout.tv_usec = 0;
     
    13571482                        FD_SET( Net_conns[conn_id].channel, &wfds);
    13581483                        selret = select(FD_SETSIZE, NULL, &wfds, NULL, &timeout);
     1484#endif
    13591485                        if(selret > 0)
    13601486                        {
     
    13621488                                if( wrote == -1 )
    13631489                                {
    1364 /*
    1365                 dna_report_error(conn_id, 0,
    1366                         "Writing to", DIM_ERROR, DIMTCPWRRTY);
    1367 */
     1490                                        dna_report_error(conn_id, 0,
     1491                                                "Writing to", DIM_ERROR, DIMTCPWRRTY);
    13681492                                        return(0);
    13691493                                }
     
    13721496                else
    13731497                {
    1374 /*
    1375 dna_report_error(conn_id, 0,
    1376                         "Writing (non-blocking) to", DIM_ERROR, DIMTCPWRRTY);
    1377 */
     1498                        dna_report_error(conn_id, 0,
     1499                                "Writing (non-blocking) to", DIM_ERROR, DIMTCPWRRTY);
    13781500                        return(0);
    13791501                }
Note: See TracChangeset for help on using the changeset viewer.