Changeset 12757 for trunk/FACT++/dim/src/tcpip.c
- Timestamp:
- 01/24/12 13:41:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/dim/src/tcpip.c
r11121 r12757 89 89 static int DIM_IO_valid = 1; 90 90 91 static int Write_timeout = 5; 91 static int Keepalive_timeout_set = 0; 92 static int Write_timeout = WRITE_TMOUT; 93 static int Write_timeout_set = 0; 92 94 static int Write_buffer_size = TCP_SND_BUF_SIZE; 93 95 static int Read_buffer_size = TCP_RCV_BUF_SIZE; … … 96 98 int Tcpip_max_io_data_read = TCP_RCV_BUF_SIZE - 16; 97 99 100 void dim_set_keepalive_timeout(int secs) 101 { 102 Keepalive_timeout_set = secs; 103 } 104 105 int 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 98 117 void dim_set_write_timeout(int secs) 99 118 { 100 Write_timeout = secs; 119 Write_timeout = secs; 120 Write_timeout_set = 1; 101 121 } 102 122 103 123 int dim_get_write_timeout() 104 124 { 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); 106 134 } 107 135 … … 196 224 void tcpip_pipe_sig_handler(); 197 225 #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(); 200 232 #ifdef WIN32 201 233 init_sock(); … … 462 494 val = 3; 463 495 setsockopt(channel, IPPROTO_TCP, TCP_KEEPCNT, (char*)&val, sizeof(val)); 464 val = 2;496 val = tmout/3; 465 497 setsockopt(channel, IPPROTO_TCP, TCP_KEEPINTVL, (char*)&val, sizeof(val)); 466 498 } … … 490 522 void tcpip_set_test_write(int conn_id, int timeout) 491 523 { 524 492 525 #if defined(__linux__) && !defined (darwin) 493 526 tcpip_set_keepalive(Net_conns[conn_id].channel, timeout); 494 527 #else 528 495 529 Net_conns[conn_id].timr_ent = dtq_add_entry( queue_id, timeout, 496 530 tcpip_test_write, conn_id ); 497 531 Net_conns[conn_id].timeout = timeout; 498 532 Net_conns[conn_id].last_used = time(NULL); 499 #endif 533 534 #endif 535 500 536 } 501 537
Note:
See TracChangeset
for help on using the changeset viewer.