Ignore:
Timestamp:
01/24/12 13:41:57 (13 years ago)
Author:
tbretz
Message:
Switched to v19r27
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/dim/src/tcpip.c

    r11121 r12757  
    8989static int DIM_IO_valid = 1;
    9090
    91 static int Write_timeout = 5;
     91static int Keepalive_timeout_set = 0;
     92static int Write_timeout = WRITE_TMOUT;
     93static int Write_timeout_set = 0;
    9294static int Write_buffer_size = TCP_SND_BUF_SIZE;
    9395static int Read_buffer_size = TCP_RCV_BUF_SIZE;
     
    9698int Tcpip_max_io_data_read = TCP_RCV_BUF_SIZE - 16;
    9799
     100void dim_set_keepalive_timeout(int secs)
     101{
     102        Keepalive_timeout_set = secs;
     103}
     104
     105int dim_get_keepalive_timeout()
     106{
     107        int ret;
     108        extern int get_keepalive_tmout();
     109
     110        if(!(ret = Keepalive_timeout_set))
     111        {
     112                ret = get_keepalive_tmout();
     113        }
     114        return(ret);
     115}
     116
    98117void dim_set_write_timeout(int secs)
    99118{
    100   Write_timeout = secs;
     119        Write_timeout = secs;
     120        Write_timeout_set = 1;
    101121}
    102122
    103123int dim_get_write_timeout()
    104124{
    105   return(Write_timeout);
     125        int ret;
     126        extern int get_write_tmout();
     127
     128        if(!Write_timeout_set)
     129        {
     130                if((ret = get_write_tmout()))
     131                        Write_timeout = ret;
     132        }
     133        return(Write_timeout);
    106134}
    107135
     
    196224        void tcpip_pipe_sig_handler();
    197225#endif
    198 
    199         if(init_done) return(1);
     226        extern int get_write_tmout();
     227
     228        if(init_done)
     229                return(1);
     230
     231        dim_get_write_timeout();
    200232#ifdef WIN32
    201233        init_sock();
     
    462494   val = 3;
    463495   setsockopt(channel, IPPROTO_TCP, TCP_KEEPCNT, (char*)&val, sizeof(val));
    464    val = 2;
     496   val = tmout/3;
    465497   setsockopt(channel, IPPROTO_TCP, TCP_KEEPINTVL, (char*)&val, sizeof(val));
    466498}
     
    490522void tcpip_set_test_write(int conn_id, int timeout)
    491523{
     524
    492525#if defined(__linux__) && !defined (darwin)
    493526        tcpip_set_keepalive(Net_conns[conn_id].channel, timeout);
    494527#else
     528
    495529        Net_conns[conn_id].timr_ent = dtq_add_entry( queue_id, timeout,
    496530                tcpip_test_write, conn_id );
    497531        Net_conns[conn_id].timeout = timeout;
    498532        Net_conns[conn_id].last_used = time(NULL);
    499 #endif
     533
     534#endif
     535
    500536}
    501537
Note: See TracChangeset for help on using the changeset viewer.