Changeset 13135
- Timestamp:
- 03/18/12 20:53:49 (13 years ago)
- Location:
- trunk/FACT++/dim
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/dim/README_v19.txt
r12757 r13135 1 1 2 DIM version 19. 27Release Notes2 DIM version 19.30 Release Notes 3 3 4 4 Notes 1 and 2 for Unix Users only … … 17 17 Dns </dev/null >& dns.log & 18 18 19 NOTE 3: The Version Number service provided by servers is now set to 1927. 19 NOTE 3: The Version Number service provided by servers is now set to 1930. 20 21 14/03/2012 22 Changes for version 19.30: 23 - Sometimes when trying to open a connection to a server the client could backoff for too 24 long (10 seconds), now it will retry immediately and then at increasing intervals. 25 - dim_stop() would sometimes not properly stop all threads if a new connection was received 26 in the mean time. 27 - The DimServerDns destructor could crash, fixed. 28 - Removed some compiler warnings about variables set but not used. 29 - Two new functions available: 30 - dim_set_listen_backlog(int size) 31 - int dim_get_listen_backlog() 32 - The DNS will set the listen_backlog to 1024 at startup, but the OS will truncate it to 33 a maximum limit (available in /proc/sys/net/core/somaxconn, linux default=128), 34 while for servers the constant SOMAXCONN is used. 35 36 37 06/02/2012 38 Changes for version 19.28: 39 - Added more log messages when a "Write Timeout" occurs to know where it originated. 40 - A server could sometimes not release the connection in case of a "Write Timeout", and 41 then keep on timing out for each message on this connection - fixed. 42 20 43 21 44 19/01/2012 -
trunk/FACT++/dim/dim/dim.h
r12757 r13135 14 14 #include "dim_common.h" 15 15 16 #define DIM_VERSION_NUMBER 19 2716 #define DIM_VERSION_NUMBER 1930 17 17 18 18 #define MY_LITTLE_ENDIAN 0x1 -
trunk/FACT++/dim/dim/dim_common.h
r12757 r13135 204 204 _DIM_PROTOE( void dim_set_keepalive_timeout, (int secs) ); 205 205 _DIM_PROTOE( int dim_get_keepalive_timeout, () ); 206 _DIM_PROTOE( void dim_set_listen_backlog, (int size) ); 207 _DIM_PROTOE( int dim_get_listen_backlog, () ); 206 208 207 209 #ifdef WIN32 -
trunk/FACT++/dim/src/dic.c
r12757 r13135 29 29 #endif 30 30 31 #define BAD_CONN_TIMEOUT 1031 #define BAD_CONN_TIMEOUT 2 32 32 33 33 … … 1314 1314 char *node_name, *task_name; 1315 1315 char node_info[MAX_NODE_NAME+4]; 1316 int i, port, protocol, format, ret,pid;1316 int i, port, protocol, format, pid; 1317 1317 register DIC_CONNECTION *dic_connp ; 1318 1318 DIC_DNS_PACKET dic_dns_packet; … … 1489 1489 strncpy( bad_connp->conn.task_name, task_name, MAX_TASK_NAME); 1490 1490 bad_connp->conn.port = port; 1491 tmout = BAD_CONN_TIMEOUT * bad_connp->n_retries;1491 tmout = BAD_CONN_TIMEOUT * (bad_connp->n_retries - 1); 1492 1492 if(tmout > 120) 1493 1493 tmout = 120; … … 1530 1530 servp->conn_id = conn_id; 1531 1531 1532 ret =send_service_command( servp );1532 send_service_command( servp ); 1533 1533 /* 1534 1534 if( ret == 1) … … 1942 1942 } 1943 1943 */ 1944 if(!ret) 1945 { 1946 dim_print_date_time(); 1947 printf(" Client Sending Command: Couldn't write to Conn %3d : Server %s@%s\n",conn_id, 1948 Net_conns[conn_id].task, Net_conns[conn_id].node); 1949 fflush(stdout); 1950 } 1944 1951 return(ret); 1945 1952 } … … 2244 2251 void dic_stop() 2245 2252 { 2253 int dic_find_server_conns(); 2254 2246 2255 dtq_delete(Dic_timer_q); 2247 2256 dic_close_dns(); 2248 dim_stop(); 2257 if(!dic_find_server_conns()) 2258 dim_stop(); 2259 } 2260 2261 int dic_find_server_conns() 2262 { 2263 int i; 2264 int n = 0; 2265 2266 for( i = 0; i< Curr_N_Conns; i++ ) 2267 { 2268 if(Net_conns[i].channel != 0) 2269 { 2270 if(Dna_conns[i].read_ast == recv_rout) 2271 { 2272 dna_close(i); 2273 } 2274 else 2275 { 2276 n++; 2277 } 2278 } 2279 } 2280 return(n); 2249 2281 } 2250 2282 -
trunk/FACT++/dim/src/dim_thr.c
r12585 r13135 182 182 void dim_stop() 183 183 { 184 void dim_tcpip_stop(), dim_dtq_stop(); 185 /* 184 186 int i; 185 187 int n = 0; 186 void dim_tcpip_stop(), dim_dtq_stop();187 188 188 189 for( i = 0; i< Curr_N_Conns; i++ ) … … 193 194 if(n) 194 195 return; 196 */ 195 197 if(IO_thread) 196 198 pthread_cancel(IO_thread); … … 666 668 void dim_stop_threads() 667 669 { 670 /* 668 671 int i; 669 672 int n = 0; … … 676 679 if(n) 677 680 return; 681 */ 678 682 if(hIO_thread) 679 683 TerminateThread(hIO_thread, 0); -
trunk/FACT++/dim/src/dis.c
r12757 r13135 1388 1388 register SERVICE *servp; 1389 1389 char str[80], def[MAX_NAME]; 1390 register char *ptr; 1391 int last_conn_id; 1390 int conn_id, last_conn_id; 1392 1391 int *pkt_buffer, header_size, aux; 1393 1392 #ifdef WIN32 … … 1406 1405 reqp->delay_delete++; 1407 1406 servp = reqp->service_ptr; 1407 conn_id = reqp->conn_id; 1408 1409 if(Debug_on) 1410 { 1411 dim_print_date_time(); 1412 printf("Updating %s for %s@%s (req_id = %d)\n", 1413 servp->name, 1414 Net_conns[conn_id].task, Net_conns[conn_id].node, 1415 reqp->req_id); 1416 } 1417 1408 1418 last_conn_id = Curr_conn_id; 1409 Curr_conn_id = reqp->conn_id; 1410 ptr = servp->def; 1419 Curr_conn_id = conn_id; 1411 1420 if(servp->type == COMMAND) 1412 1421 { … … 1415 1424 size = 26; 1416 1425 sprintf(def,"c:26"); 1417 ptr = def;1418 1426 } 1419 1427 else if( servp->user_routine != 0 ) … … 1491 1499 buffp, size); 1492 1500 Dis_packet->size = htovl(header_size + size); 1493 if( !dna_write_nowait(reqp->conn_id, Dis_packet, header_size + size) ) 1494 { 1501 if( !dna_write_nowait(conn_id, Dis_packet, header_size + size) ) 1502 { 1503 if(Net_conns[conn_id].write_timedout) 1504 { 1505 dim_print_date_time(); 1506 if(reqp->delay_delete > 1) 1507 { 1508 printf(" Server (Explicitly) Updating Service %s: Couldn't write to Conn %3d : Client %s@%s\n", 1509 servp->name, conn_id, 1510 Net_conns[conn_id].task, Net_conns[conn_id].node); 1511 } 1512 else 1513 { 1514 printf(" Server Updating Service %s: Couldn't write to Conn %3d : Client %s@%s\n", 1515 servp->name, conn_id, 1516 Net_conns[conn_id].task, Net_conns[conn_id].node); 1517 } 1518 } 1519 fflush(stdout); 1495 1520 if(reqp->delay_delete > 1) 1496 1521 { … … 1500 1525 { 1501 1526 reqp->delay_delete = 0; 1502 release_conn( reqp->conn_id, 1, 0);1527 release_conn(conn_id, 1, 0); 1503 1528 } 1504 1529 } … … 1513 1538 } 1514 1539 */ 1515 reqp->delay_delete--; 1540 if(reqp->delay_delete > 0) 1541 reqp->delay_delete--; 1516 1542 return(1); 1517 1543 } … … 1520 1546 { 1521 1547 register REQUEST *reqp; 1522 register SERVICE *servp;1523 1548 static DIS_PACKET *dis_packet; 1524 1549 static int packet_size = 0; … … 1528 1553 if(!reqp) 1529 1554 return; 1530 servp = reqp->service_ptr;1531 1555 if( !packet_size ) { 1532 1556 dis_packet = (DIS_PACKET *)malloc(DIS_HEADER); … … 1708 1732 (DLL *) reqp)) ) 1709 1733 { 1734 /* 1710 1735 if(Debug_on) 1711 1736 { … … 1715 1740 Net_conns[reqp->conn_id].task, Net_conns[reqp->conn_id].node, reqp->req_id, (unsigned long)reqp); 1716 1741 } 1742 */ 1717 1743 if(check_client(reqp, client_ids)) 1718 1744 { … … 2051 2077 if( !dna_write_nowait(conn_id, dis_packet, size + DIS_HEADER) ) 2052 2078 { 2079 dim_print_date_time(); 2080 printf(" Server Sending Service: Couldn't write to Conn %3d : Client %s@%s\n",conn_id, 2081 Net_conns[conn_id].task, Net_conns[conn_id].node); 2082 fflush(stdout); 2053 2083 release_conn(conn_id, 1, 0); 2054 2084 } … … 2142 2172 n_services = dnsp->dis_n_services; 2143 2173 2144 ENABLE_AST2145 2174 if(dnsp->serving) 2146 2175 { 2147 2176 if(n_services == 5) 2148 2177 { 2178 if(Dis_conn_id) 2179 { 2180 dna_close(Dis_conn_id); 2181 Dis_conn_id = 0; 2182 } 2183 ENABLE_AST 2149 2184 /* 2150 2185 dis_stop_serving(); … … 2152 2187 do_dis_stop_serving_dns(dnsp); 2153 2188 } 2189 else 2190 { 2191 ENABLE_AST 2192 } 2193 } 2194 else 2195 { 2196 ENABLE_AST 2154 2197 } 2155 2198 return(found); … … 2281 2324 register SERVICE *servp, *prevp; 2282 2325 void dim_stop_threads(void); 2326 int dis_find_client_conns(); 2283 2327 int hash_index; 2284 2328 … … 2335 2379 if(Serving != -1) 2336 2380 */ 2337 dim_stop_threads(); 2381 if(!dis_find_client_conns()) 2382 dim_stop_threads(); 2383 } 2384 2385 int dis_find_client_conns() 2386 { 2387 int i; 2388 int n = 0; 2389 2390 for( i = 0; i< Curr_N_Conns; i++ ) 2391 { 2392 if(Net_conns[i].channel != 0) 2393 { 2394 if(Dna_conns[i].read_ast == dis_insert_request) 2395 { 2396 dna_close(i); 2397 } 2398 else 2399 { 2400 n++; 2401 } 2402 } 2403 } 2404 return(n); 2338 2405 } 2339 2406 -
trunk/FACT++/dim/src/discpp.cxx
r12757 r13135 312 312 void DimServerDns::init(const char *node, int port) 313 313 { 314 if(!itsNode)315 {314 // if(!itsNode) 315 // { 316 316 itsNode = new char[strlen(node)+1]; 317 317 strcpy(itsNode,node); 318 }318 // } 319 319 itsPort = port; 320 320 autoStart = 1; … … 365 365 // delete[] itsName; 366 366 } 367 if(itsNode)367 // if(itsNode) 368 368 delete[] itsNode; 369 369 } -
trunk/FACT++/dim/src/dna.c
r12757 r13135 821 821 if (tcpip_failure(tcpip_code)) 822 822 { 823 dim_print_date_time(); 824 printf(" Client Establishing Connection: Couldn't write to Conn %3d : Server %s@%s\n",conn_id, 825 Net_conns[conn_id].task, Net_conns[conn_id].node); 826 fflush(stdout); 823 827 dna_close(conn_id); 824 828 return(0); … … 934 938 } 935 939 } 936 -
trunk/FACT++/dim/src/dns.c
r12757 r13135 1438 1438 } 1439 1439 dim_set_write_timeout(10); 1440 dim_set_listen_backlog(1024); 1440 1441 dim_init(); 1441 1442 conn_arr_create( SRC_DNS ); -
trunk/FACT++/dim/src/dtq.c
r11071 r13135 85 85 struct sigaction sig_info; 86 86 sigset_t set; 87 int pid, ret = 0; 88 87 int ret = 0; 88 89 /* 89 90 pid = getpid(); 91 */ 90 92 if( !sigvec_done) 91 93 { … … 796 798 int dtq_stop_timer(long tag) 797 799 { 798 TIMR_ENT *entry, *queue_head , *prevp;800 TIMR_ENT *entry, *queue_head; 799 801 int time_left = -1; 800 802 801 803 queue_head = timer_queues[SPECIAL_QUEUE].queue_head; 802 804 entry = queue_head; 803 prevp = entry;804 805 while( (entry = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)entry)) ) 805 806 { -
trunk/FACT++/dim/src/examples/test_server.c
r12757 r13135 74 74 int new_dns = 0; 75 75 int index = 0; 76 /* 77 dim_set_write_timeout(1); 78 */ 76 79 /* 77 80 int buf_sz, buf_sz1; -
trunk/FACT++/dim/src/tcpip.c
r12757 r13135 89 89 static int DIM_IO_valid = 1; 90 90 91 static int Listen_backlog = SOMAXCONN; 91 92 static int Keepalive_timeout_set = 0; 92 93 static int Write_timeout = WRITE_TMOUT; … … 97 98 int Tcpip_max_io_data_write = TCP_SND_BUF_SIZE - 16; 98 99 int Tcpip_max_io_data_read = TCP_RCV_BUF_SIZE - 16; 100 101 void dim_set_listen_backlog(int size) 102 { 103 Listen_backlog = size; 104 } 105 106 int dim_get_listen_backlog() 107 { 108 return(Listen_backlog); 109 } 99 110 100 111 void dim_set_keepalive_timeout(int secs) … … 1138 1149 } 1139 1150 1140 if( (ret = listen(path, SOMAXCONN)) == -1 )1151 if( (ret = listen(path, Listen_backlog)) == -1 ) 1141 1152 { 1142 1153 closesock(path);
Note:
See TracChangeset
for help on using the changeset viewer.