Changeset 12757 for trunk/FACT++/dim
- Timestamp:
- 01/24/12 13:41:57 (13 years ago)
- Location:
- trunk/FACT++/dim
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/dim/README_v19.txt
r12585 r12757 1 1 2 DIM version 19.2 6Release Notes2 DIM version 19.27 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 1926. 19 NOTE 3: The Version Number service provided by servers is now set to 1927. 20 21 19/01/2012 22 Changes for version 19.27: 23 - Updated the DIM Makefiles for MacOSX (Darwin) 24 - Added New possibilities to change DIM timeouts: 25 - 2 New Environment variables: 26 - DIM_WRITE_TMOUT (default: 5) 27 - DIM_KEEPALIVE_TMOUT (default: 15) 28 - Same functionality as the functions: 29 - dim_set_write_timeout(int secs) 30 - int dim_get_write_timeout() 31 - dim_set_keepalive_timeout(int secs) //new 32 - int dim_get_keepalive_timeout() //new 33 - The functions have precedence over the environment variables. 34 - The server per client exit_handler functionality 35 (provided by dis_add_client_exit_handler()/dis_set_client_exit_handler()) 36 wan not always working correctly (in case of write timeouts) - fixed. 37 - Changed the reporting of "Write Tiemout": 38 - Used to report only: 39 - "ERROR: Write Timeout, disconnecting from..." 40 - Now reports: 41 - "WARNING: Write Timeout, writing to ..." 42 - If it disconnects: "ERROR: Write Timeout, disconnecting from ..." 43 - If it reconnects later: "INFO: Re-connected to ..." 44 20 45 21 46 14/09/2011 -
trunk/FACT++/dim/dim/dim.h
r12585 r12757 14 14 #include "dim_common.h" 15 15 16 #define DIM_VERSION_NUMBER 192 616 #define DIM_VERSION_NUMBER 1927 17 17 18 18 #define MY_LITTLE_ENDIAN 0x1 … … 203 203 #define TEST_TIME_VMS 30 /* Interval to test conn. */ 204 204 #define TEST_WRITE_TAG 25 /* DTQ tag for test writes */ 205 #define WRITE_TMOUT 5 /* Interval to wait while writing. */ 205 206 206 207 #define OPN_MAGIC 0xc0dec0de /* Magic value 1st packet */ -
trunk/FACT++/dim/dim/dim_common.h
r11071 r12757 202 202 _DIM_PROTOE( void dis_set_debug_on, () ); 203 203 _DIM_PROTOE( void dis_set_debug_off, () ); 204 _DIM_PROTOE( void dim_set_keepalive_timeout, (int secs) ); 205 _DIM_PROTOE( int dim_get_keepalive_timeout, () ); 204 206 205 207 #ifdef WIN32 -
trunk/FACT++/dim/src/dic.c
r11121 r12757 1431 1431 #endif 1432 1432 */ 1433 dna_set_test_write(conn_id, TEST_TIME_OSK);1433 dna_set_test_write(conn_id, dim_get_keepalive_timeout()); 1434 1434 dic_connp = &Dic_conns[conn_id]; 1435 1435 strncpy( dic_connp->node_name, node_name, -
trunk/FACT++/dim/src/diccpp.cxx
r11881 r12757 95 95 int DimInfo::getTimestamp() 96 96 { 97 int ret; 98 99 ret = dic_get_timestamp(itsId, &secs, &millisecs); 97 98 dic_get_timestamp(itsId, &secs, &millisecs); 100 99 return(secs); 101 100 } -
trunk/FACT++/dim/src/dis.c
r12585 r12757 133 133 int conn_id; 134 134 int exit_id; 135 char node[MAX_NODE_NAME]; 136 char task[MAX_TASK_NAME]; 135 137 } EXIT_H; 136 138 … … 1966 1968 1967 1969 DISABLE_AST 1970 *secs = 0; 1971 *millisecs = 0; 1968 1972 if(!serv_id) 1969 1973 { … … 1989 1993 *millisecs = servp->user_millisecs; 1990 1994 } 1995 /* 1991 1996 else 1992 1997 { … … 1994 1999 *millisecs = 0; 1995 2000 } 2001 */ 1996 2002 ENABLE_AST 1997 2003 return(1); … … 2345 2351 if(!(clip = find_client(conn_id))) 2346 2352 { 2353 /* 2354 dna_set_test_write(conn_id, 15); 2355 */ 2347 2356 clip = (CLIENT *)malloc(sizeof(CLIENT)); 2348 2357 clip->conn_id = conn_id; … … 2941 2950 ENABLE_AST 2942 2951 } 2943 2952 2953 static void add_exit_handler_item(int conn_id, int tag) 2954 { 2955 EXIT_H *newp; 2956 2957 DISABLE_AST 2958 if(!Exit_h_head) 2959 { 2960 Exit_h_head = (EXIT_H *)malloc(sizeof(EXIT_H)); 2961 sll_init( (SLL *) Exit_h_head ); 2962 } 2963 if( (newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 2964 (char *)&conn_id, 4)) ) 2965 { 2966 newp->conn_id = conn_id; 2967 newp->exit_id = tag; 2968 strcpy(newp->node, Net_conns[conn_id].node); 2969 strcpy(newp->task, Net_conns[conn_id].task); 2970 } 2971 else 2972 { 2973 newp = (EXIT_H *)malloc(sizeof(EXIT_H)); 2974 newp->conn_id = conn_id; 2975 newp->exit_id = tag; 2976 strcpy(newp->node, Net_conns[conn_id].node); 2977 strcpy(newp->task, Net_conns[conn_id].task); 2978 sll_insert_queue( (SLL *) Exit_h_head, (SLL *) newp ); 2979 } 2980 ENABLE_AST 2981 } 2982 2983 static void rem_exit_handler_item(EXIT_H *exitp) 2984 { 2985 2986 DISABLE_AST 2987 if(!Exit_h_head) 2988 { 2989 ENABLE_AST 2990 return; 2991 } 2992 sll_remove( (SLL *) Exit_h_head, (SLL *) exitp ); 2993 free(exitp); 2994 ENABLE_AST 2995 } 2996 2997 static EXIT_H *find_exit_handler_item(int conn_id) 2998 { 2999 EXIT_H *exitp; 3000 3001 DISABLE_AST; 3002 if(!Exit_h_head) 3003 { 3004 ENABLE_AST; 3005 return((EXIT_H *)0); 3006 } 3007 if( (exitp = (EXIT_H *) sll_search((SLL *) Exit_h_head, (char *) &conn_id, 4)) ) 3008 { 3009 ENABLE_AST; 3010 return(exitp); 3011 } 3012 ENABLE_AST; 3013 return((EXIT_H *)0); 3014 } 3015 3016 static int check_exit_handler_item(EXIT_H *exitp, int conn_id) 3017 { 3018 if( (!strcmp(exitp->node, Net_conns[conn_id].node)) && 3019 (!strcmp(exitp->task, Net_conns[conn_id].task))) 3020 { 3021 return exitp->exit_id; 3022 } 3023 return 0; 3024 } 3025 2944 3026 void add_exit_handler(int *tag, int *bufp, int *size) 2945 3027 { 2946 EXIT_H * newp;3028 EXIT_H *exitp; 2947 3029 2948 3030 if(size){} … … 2950 3032 if(*bufp) 2951 3033 { 2952 if(!Exit_h_head) 2953 { 2954 Exit_h_head = (EXIT_H *)malloc(sizeof(EXIT_H)); 2955 sll_init( (SLL *) Exit_h_head ); 2956 } 2957 newp = (EXIT_H *)malloc(sizeof(EXIT_H)); 2958 newp->conn_id = Curr_conn_id; 2959 newp->exit_id = *bufp; 2960 sll_insert_queue( (SLL *) Exit_h_head, (SLL *) newp ); 3034 add_exit_handler_item(Curr_conn_id, *bufp); 2961 3035 } 2962 3036 else 2963 3037 { 2964 if(!Exit_h_head) 2965 return; 2966 if((newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 2967 (char *)&Curr_conn_id, 4)) ) 2968 { 2969 sll_remove( (SLL *) Exit_h_head, (SLL *) newp ); 2970 } 3038 if((exitp = find_exit_handler_item(Curr_conn_id))) 3039 rem_exit_handler_item(exitp); 2971 3040 } 2972 3041 } … … 2974 3043 void dis_set_client_exit_handler(int conn_id, int tag) 2975 3044 { 2976 EXIT_H *newp; 2977 2978 DISABLE_AST 3045 EXIT_H *exitp; 3046 2979 3047 if(tag) 2980 3048 { 2981 if(!Exit_h_head) 2982 { 2983 Exit_h_head = (EXIT_H *)malloc(sizeof(EXIT_H)); 2984 sll_init( (SLL *) Exit_h_head ); 2985 } 2986 if( (newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 2987 (char *)&conn_id, 4)) ) 2988 { 2989 newp->conn_id = conn_id; 2990 newp->exit_id = tag; 3049 add_exit_handler_item(conn_id, tag); 3050 } 3051 else 3052 { 3053 if((exitp = find_exit_handler_item(conn_id))) 3054 rem_exit_handler_item(exitp); 3055 } 3056 } 3057 3058 3059 int do_exit_handler(int conn_id) 3060 { 3061 register EXIT_H *exitp; 3062 int exit_id; 3063 3064 DISABLE_AST; 3065 if((exitp = find_exit_handler_item(conn_id))) 3066 { 3067 if((exit_id = check_exit_handler_item(exitp, conn_id))) 3068 { 3069 (Client_exit_user_routine)( &exit_id ); 2991 3070 } 2992 3071 else 2993 3072 { 2994 newp = (EXIT_H *)malloc(sizeof(EXIT_H)); 2995 newp->conn_id = conn_id; 2996 newp->exit_id = tag; 2997 sll_insert_queue( (SLL *) Exit_h_head, (SLL *) newp ); 2998 } 2999 } 3000 else 3001 { 3002 if(!Exit_h_head) 3003 { 3004 ENABLE_AST 3005 return; 3006 } 3007 if( (newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 3008 (char *)&conn_id, 4)) ) 3009 { 3010 sll_remove( (SLL *) Exit_h_head, (SLL *) newp ); 3011 } 3012 } 3013 ENABLE_AST 3014 } 3015 3016 int do_exit_handler(int conn_id) 3017 { 3018 register EXIT_H *exitp; 3019 3020 DISABLE_AST; 3073 rem_exit_handler_item(exitp); 3074 } 3075 } 3076 /* 3021 3077 if(!Exit_h_head) 3022 3078 { … … 3030 3086 free(exitp); 3031 3087 } 3088 */ 3032 3089 ENABLE_AST 3033 3090 return(1); -
trunk/FACT++/dim/src/discpp.cxx
r11695 r12757 1332 1332 int DimCommand::getTimestamp() 1333 1333 { 1334 int ret;1335 1334 1336 1335 if(secs == 0) 1337 ret =dis_get_timestamp(itsId, &secs, &millisecs);1336 dis_get_timestamp(itsId, &secs, &millisecs); 1338 1337 return(secs); 1339 1338 } -
trunk/FACT++/dim/src/dna.c
r11071 r12757 31 31 int port; 32 32 SRC_TYPES src_type; 33 time_t last_used; 33 34 } PENDING_OPEN; 34 35 36 #define TMOUT_PENDING_CONN_TMOUT 3600 37 #define MAX_TMOUT_PENDING_CONNS 10 35 38 static PENDING_OPEN Pending_conns[MAX_CONNS]; 39 static PENDING_OPEN Pending_conns_tmout[MAX_TMOUT_PENDING_CONNS]; 36 40 37 41 static int DNA_Initialized = FALSE; … … 311 315 { 312 316 dna_report_error(conn_id, -1, 313 "Write timeout, disconnecting from", DIM_ERROR, DIMTCPWRTMO);317 "Write timeout, writing to", DIM_WARNING, DIMTCPWRTMO); 314 318 wrote = 0; 315 319 } … … 526 530 int dna_init() 527 531 { 532 PENDING_OPEN *pending_connp; 533 int i, size; 534 528 535 if(!DNA_Initialized) 529 536 { 530 537 conn_arr_create(SRC_DNA); 538 pending_connp = &Pending_conns[1]; 539 size = MAX_CONNS; 540 for( i = 1; i < size; i++, pending_connp++ ) 541 pending_connp->task_name[0] = '\0'; 542 pending_connp = &Pending_conns_tmout[1]; 543 size = MAX_TMOUT_PENDING_CONNS; 544 for( i = 1; i < size; i++, pending_connp++ ) 545 pending_connp->task_name[0] = '\0'; 531 546 DNA_Initialized = TRUE; 532 547 } … … 540 555 register int conn_id; 541 556 557 dna_init(); 558 /* 542 559 if(!DNA_Initialized) 543 560 { … … 545 562 DNA_Initialized = TRUE; 546 563 } 564 */ 547 565 *protocol = PROTOCOL; 548 566 conn_id = conn_get(); … … 600 618 } 601 619 602 static int ins_pend_conn( char *node, char *task, int port, SRC_TYPES src_type )620 static int ins_pend_conn( char *node, char *task, int port, SRC_TYPES src_type, int type, time_t last_used ) 603 621 { 604 622 register PENDING_OPEN *pending_connp; 605 register int i; 606 607 for( i = 1, pending_connp = &Pending_conns[1]; i < MAX_CONNS; 608 i++, pending_connp++ ) 623 register int i, size; 624 time_t oldest; 625 int oldesti; 626 627 if(type == 0) 628 { 629 pending_connp = &Pending_conns[1]; 630 size = MAX_CONNS; 631 oldest = 0; 632 } 633 else 634 { 635 pending_connp = &Pending_conns_tmout[1]; 636 size = MAX_TMOUT_PENDING_CONNS; 637 oldest = time(NULL); 638 oldesti = 1; 639 } 640 641 for( i = 1; i < size; i++, pending_connp++ ) 609 642 { 610 643 if( pending_connp->task_name[0] == '\0' ) … … 614 647 pending_connp->port = port; 615 648 pending_connp->src_type = src_type; 649 pending_connp->last_used = last_used; 616 650 return(i); 617 651 } 652 else 653 { 654 if(pending_connp->last_used < oldest) 655 { 656 oldest = pending_connp->last_used; 657 oldesti = i; 658 } 659 } 660 } 661 if(type != 0) 662 { 663 pending_connp = &Pending_conns_tmout[oldesti]; 664 strcpy(pending_connp->node_name, node); 665 strcpy(pending_connp->task_name, task); 666 pending_connp->port = port; 667 pending_connp->src_type = src_type; 668 pending_connp->last_used = last_used; 669 return(oldesti); 618 670 } 619 671 return(0); 620 672 } 621 673 622 static int find_pend_conn( char *node, char *task, int port, SRC_TYPES src_type )674 static int find_pend_conn( char *node, char *task, int port, SRC_TYPES src_type, int type ) 623 675 { 624 676 register PENDING_OPEN *pending_connp; 625 register int i; 626 627 for( i = 1, pending_connp = &Pending_conns[1]; i < MAX_CONNS; 628 i++, pending_connp++ ) 677 register int i, size; 678 time_t curr_time; 679 680 if(type == 0) 681 { 682 pending_connp = &Pending_conns[1]; 683 size = MAX_CONNS; 684 } 685 else 686 { 687 pending_connp = &Pending_conns_tmout[1]; 688 size = MAX_TMOUT_PENDING_CONNS; 689 curr_time = time(NULL); 690 for( i = 1; i < size; i++, pending_connp++ ) 691 { 692 if( pending_connp->task_name[0] != '\0' ) 693 { 694 if( curr_time - pending_connp->last_used > TMOUT_PENDING_CONN_TMOUT ) 695 { 696 pending_connp->task_name[0] = '\0'; 697 } 698 } 699 } 700 pending_connp = &Pending_conns_tmout[1]; 701 } 702 for( i = 1; i < size; i++, pending_connp++ ) 629 703 { 630 704 if( (!strcmp(pending_connp->node_name, node)) && … … 640 714 641 715 642 static void rel_pend_conn( int conn_id ) 643 { 644 Pending_conns[conn_id].task_name[0] = '\0'; 716 static void rel_pend_conn( int id, int type ) 717 { 718 register PENDING_OPEN *pending_connp; 719 720 if(type == 0) 721 { 722 pending_connp = &Pending_conns[id]; 723 } 724 else 725 { 726 pending_connp = &Pending_conns_tmout[id]; 727 } 728 pending_connp->task_name[0] = '\0'; 645 729 } 646 730 … … 657 741 658 742 if(server_protocol){} 743 dna_init(); 744 /* 659 745 if(!DNA_Initialized) { 660 746 conn_arr_create(SRC_DNA); 661 747 DNA_Initialized = TRUE; 662 748 } 749 */ 663 750 conn_id = conn_get(); 664 751 dna_connp = &Dna_conns[conn_id] ; … … 676 763 { 677 764 #endif 678 if(!find_pend_conn(server_node, server_task, port, src_type ))765 if(!find_pend_conn(server_node, server_task, port, src_type, 0)) 679 766 { 680 767 if(src_type == SRC_DIS) … … 690 777 else 691 778 dna_report_error( conn_id, tcpip_code, str, DIM_ERROR, DIMTCPCNERR ); 692 ins_pend_conn(server_node, server_task, port, src_type );779 ins_pend_conn(server_node, server_task, port, src_type, 0, 0); 693 780 } 694 781 #ifdef VMS … … 699 786 return(0); 700 787 } 701 if( (id = find_pend_conn(server_node, server_task, port, src_type )) )788 if( (id = find_pend_conn(server_node, server_task, port, src_type, 0)) ) 702 789 { 703 790 if(src_type == SRC_DIS) … … 712 799 else 713 800 dna_report_error( conn_id, -1, str, DIM_INFO, DIMTCPCNEST ); 714 rel_pend_conn(id );801 rel_pend_conn(id, 0); 715 802 } 716 803 dna_connp->state = RD_HDR; … … 744 831 { 745 832 if(conn_id > 0) 833 { 834 if(Net_conns[conn_id].write_timedout) 835 { 836 dna_report_error(conn_id, -1, 837 "Write timeout, disconnecting from", DIM_ERROR, DIMTCPWRTMO); 838 if(!find_pend_conn(Net_conns[conn_id].node, Net_conns[conn_id].task, 0, 0, 1)) 839 ins_pend_conn(Net_conns[conn_id].node, Net_conns[conn_id].task, 0, 0, 1, time(NULL)); 840 } 746 841 release_conn(conn_id); 842 } 747 843 return(1); 748 844 } … … 810 906 if(Net_conns[conn_id].node[0]) 811 907 { 812 sprintf(str," %s on node%s",908 sprintf(str," %s@%s", 813 909 Net_conns[conn_id].task, Net_conns[conn_id].node); 814 910 strcat(msg, str); … … 829 925 static void save_node_task(int conn_id, DNA_NET *buffer) 830 926 { 927 int id; 831 928 strcpy(Net_conns[conn_id].node, buffer->node); 832 929 strcpy(Net_conns[conn_id].task, buffer->task); 833 } 834 930 if((id = find_pend_conn(Net_conns[conn_id].node, Net_conns[conn_id].task, 0, 0, 1))) 931 { 932 dna_report_error( conn_id, -1, "Re-connected to", DIM_INFO, DIMDNSCNEST ); 933 rel_pend_conn(id, 1); 934 } 935 } 936 -
trunk/FACT++/dim/src/dns.c
r11121 r12757 310 310 if(strcmp(Dns_conns[conn_id].task_name,"DIS_DNS")) 311 311 { 312 dna_set_test_write(conn_id, 10);312 dna_set_test_write(conn_id, dim_get_keepalive_timeout()); 313 313 } 314 314 Dns_conns[conn_id].old_n_services = 0; … … 329 329 { 330 330 if(strcmp(Dns_conns[conn_id].task_name,"DIS_DNS")) 331 dna_set_test_write(conn_id, 10);331 dna_set_test_write(conn_id, dim_get_keepalive_timeout()); 332 332 dim_print_date_time(); 333 333 printf( " Server %s out of error\n", … … 650 650 release_conn(conn_id); 651 651 } 652 Dns_conns[conn_id].validity = -Dns_conns[conn_id].validity; 652 else 653 Dns_conns[conn_id].validity = -Dns_conns[conn_id].validity; 653 654 } 654 655 } … … 716 717 dic_packet.pid = 0; 717 718 dic_packet.size = htovl(DNS_DIC_HEADER); 719 dim_print_date_time(); 720 printf(" Connection from %s refused, stopping client pid=%s\n", 721 Net_conns[conn_id].node, 722 Net_conns[conn_id].task); 723 fflush(stdout); 718 724 if( !dna_write_nowait(conn_id, &dic_packet, DNS_DIC_HEADER) ) 719 725 { … … 723 729 Net_conns[conn_id].node); 724 730 fflush(stdout); 725 release_conn(conn_id); 726 } 727 dim_print_date_time(); 728 printf(" Connection from %s refused, stopping client pid=%s\n", 729 Net_conns[conn_id].node, 730 Net_conns[conn_id].task); 731 fflush(stdout); 731 } 732 732 release_conn(conn_id); 733 733 … … 826 826 dic_packet.pid = 0; 827 827 dic_packet.size = htovl(DNS_DIC_HEADER); 828 if( Dns_conns[conn_id].src_type == SRC_NONE ) 829 dna_set_test_write(conn_id, dim_get_keepalive_timeout()); 828 830 if( !(servp = service_exists(serv_regp->service_name)) ) 829 831 { … … 986 988 DNS_DIC_PACKET packet; 987 989 char *ptr; 988 int i ;990 int i, to_release = 0; 989 991 990 992 nodep = servp->node_head; … … 1016 1018 Net_conns[nodep->conn_id].node); 1017 1019 fflush(stdout); 1020 to_release = nodep->conn_id; 1018 1021 /* 1019 1022 release_conn(nodep->conn_id); … … 1035 1038 */ 1036 1039 } 1040 if(to_release) 1041 release_conn(to_release); 1037 1042 } 1038 1043 -
trunk/FACT++/dim/src/examples/test_client.c
r12585 r12757 25 25 26 26 TT t; 27 /* 28 void big_rout( tag, buf, size ) 29 int *buf; 30 int *tag, *size; 27 28 void big_rout( int *tag, int *buf, int *size ) 31 29 { 32 30 33 printf("Received %d for TestMem\n", *buf); 31 if(size){} 32 printf("Received %d for TestMem_%d\n", *buf, *tag); 34 33 } 35 */ 34 36 35 37 36 void got_servers( int *tag, char *list, int *size) … … 57 56 void version_rout( int *tag, int *buf, int *size) 58 57 { 59 printf("Received VERSION %x, %d\n", buf, *size); 58 if(tag){} 59 printf("Received VERSION %x, %d\n", (long)buf, *size); 60 60 } 61 61 … … 64 64 int *tag, *size; 65 65 { 66 /* 66 67 char *format; 67 /*68 68 format = dic_get_format(0); 69 69 printf("Received format = %s %08x, %d\n",format, format, *size); … … 122 122 printf("%s\n",aux); 123 123 strcpy(client_str,argv[1]); 124 124 125 for(i = 0; i< 10; i++) 125 126 { … … 136 137 dic_info_service( str, MONITORED, 0, 0, 0, version_rout, 0, 137 138 NULL, 0 ); 138 /* 139 sprintf(aux,"%s/TestMem",argv[2]); 140 dic_info_service( aux, MONITORED, 0, 0, 0, big_rout, 0, 139 /* 140 for(i = 0; i < 20; i++) 141 { 142 sprintf(aux,"%s/TestMem_%d",argv[2], i); 143 dic_info_service( aux, MONITORED, 0, 0, 0, big_rout, i, 141 144 &no_link, 4 ); 145 } 142 146 */ 143 147 /* -
trunk/FACT++/dim/src/examples/test_server.c
r12585 r12757 20 20 TT t; 21 21 22 /* 22 23 23 int big_buff[1024]; 24 */ 24 25 25 26 26 void cmnd_rout(int *tag, TT *buf, int *size) … … 64 64 int main(int argc, char **argv) 65 65 { 66 int i, id, *ptr ;66 int i, id, *ptr/*, big_ids[20]*/; 67 67 char aux[80]; 68 char name[84], name1[132]; 68 char name[84]/*, name1[132]*/; 69 /* 69 70 int on = 0; 71 */ 70 72 long dnsid = 0; 71 73 char extra_dns[128]; … … 133 135 } 134 136 */ 137 135 138 /* 136 139 for(i = 1; i <= 200; i++) -
trunk/FACT++/dim/src/examples/test_server.cxx
r12585 r12757 97 97 } 98 98 99 DimService *bool_serv[10]; 99 100 void add_serv_bool(const bool & boolval) 100 101 { 101 DimService *serv;102 102 103 103 // serv = new DimService("TEST/BOOLVAL_CONST",(short &)boolval); 104 serv = new DimService("TEST/BOOLVAL_CONST","C:1", (void *)&boolval, 1); 104 bool_serv[0] = new DimService("TEST/BOOLVAL_CONST","C:1", (void *)&boolval, 1); 105 bool_serv[1] = new DimService("TEST/BOOLVAL_CONST1","C:1", (void *)&boolval, 1); 105 106 } 106 107 … … 131 132 DimService *new_servint; 132 133 134 // DimService *dim = new DimService("test","C"); 135 // delete dim; 136 133 137 DimServer::start("TEST"); 134 138 extraDns = DimUtil::getEnvVar("EXTRA_DNS_NODE"); … … 186 190 { 187 191 sleep(5); 188 189 192 /* 190 193 while(cmdsvr.hasNext()) … … 200 203 boolval = 0; 201 204 ival++; 205 bool_serv[1]->updateService(); 202 206 203 207 int inCallback = DimServer::inCallback(); -
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 -
trunk/FACT++/dim/src/utilities.c
r11071 r12757 284 284 } 285 285 } 286 287 int get_keepalive_tmout() 288 { 289 char *p; 290 291 if( (p = getenv("DIM_KEEPALIVE_TMOUT")) == NULL ) 292 return(TEST_TIME_OSK); 293 else { 294 return(atoi(p)); 295 } 296 } 297 298 int get_write_tmout() 299 { 300 char *p; 301 302 if( (p = getenv("DIM_WRITE_TMOUT")) == NULL ) 303 return(0); 304 else { 305 return(atoi(p)); 306 } 307 }
Note:
See TracChangeset
for help on using the changeset viewer.