Changeset 13995 for trunk/FACT++
- Timestamp:
- 05/31/12 10:03:22 (12 years ago)
- Location:
- trunk/FACT++/dim
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/dim/README_v19.txt
r13339 r13995 1 1 2 DIM version 19.3 1Release Notes2 DIM version 19.35 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 1931. 19 NOTE 3: The Version Number service provided by servers is now set to 1935. 20 21 24/05/2012 22 Changes for version 19.35: 23 - Fixed the DimInfo() default constructor, now if the default constructor is called, it doesn't cause the 24 destructor to crash anymore. 25 - Made available to DimInfo, DimStampedInfo, DimUpdatedInfo and DimCurrentInfo the method: 26 - void subscribe(char *name, void *nolink, int nolinksize, int time, DimInfoHandler *handler) 27 Like this the default constructor can be called and then this method called later to subscribe 28 whenever needed. 29 - The behaviour of a giving a null pointer and size 0 as "no link" parameters was not completely 30 defined. The user could get back either a null pointer or an "invalid" pointer in the callbacks. 31 This is now well-defined: 32 - If null pointer and size 0 is used at subscribe, the user will get null pointer and size 0 in the callback. 33 - If a negative size is passed at subscribe the callback is not called at all. 34 35 36 03/05/2012 37 Changes for version 19.34: 38 - Changed back to dna_write_nowait() the message that the server sends to the client when removing 39 a service. This was causing clients not to reconnect ever again when the server removed services. 40 (because the client would get the info much before the DNS, so it would keep trying to reconnect 41 and failing even though the service or even the server didn't exist anymore, without asking the DNS) 42 - Changed the client in order to avoid the behaviour above, i.e. if sending the service request fails it 43 asks the DNS again. 44 45 46 23/04/2012 47 Changes for version 19.33: 48 - A bug was introduced in v19r30. When trying to retry immediately, a dtq_start_timer(0) 49 was used (like for dna_write). This is not possible because the callback is not protected 50 by a DIM lock. Fixed. (in v19r32) 51 - Small tidy up in dic.c and protecting the move_to_xxx functions. 52 - When a server received an unsubscribe from the last subscribed service of a client it was closing the 53 connection to the client, this is not good because there could be commands being sent. In any case 54 it should be up to the client to close the connection - Fixed. 55 - dim_send_command now accepts a "-i" argument to send integer data (default is string) 56 20 57 21 58 30/03/2012 … … 25 62 as dna_write_nowait as it will mingle the packets. 26 63 - Removed more compiler warnings. 64 27 65 28 66 14/03/2012 -
trunk/FACT++/dim/dim/dic.hxx
r11695 r13995 34 34 DimInfoHandler *itsHandler; 35 35 36 DimInfo(){}; 36 DimInfo() 37 { subscribe((char *)0, 0, (void *)0, 0, 0); }; 37 38 DimInfo(const char *name, int nolink) 38 39 { subscribe((char *)name, 0, &nolink, sizeof(int), 0); }; … … 116 117 int getTimestampMillisecs(); 117 118 char *getFormat(); 119 void subscribe(char *name, void *nolink, int nolinksize, int time, 120 DimInfoHandler *handler) 121 { subscribe((char *)name, time, nolink, nolinksize, handler); }; 118 122 119 123 protected : … … 122 126 int itsTime; 123 127 int itsType; 124 int itsTagId;128 // int itsTagId; 125 129 char *itsFormat; 126 130 void *itsNolinkBuf; … … 192 196 193 197 virtual ~DimStampedInfo(); 198 void subscribe(char *name, void *nolink, int nolinksize, int time, 199 DimInfoHandler *handler) 200 { subscribe((char *)name, time, nolink, nolinksize, handler); }; 194 201 private : 195 202 void doIt(); … … 261 268 262 269 virtual ~DimUpdatedInfo(); 270 void subscribe(char *name, void *nolink, int nolinksize, int time, 271 DimInfoHandler *handler) 272 { subscribe((char *)name, time, nolink, nolinksize, handler); }; 273 263 274 private : 264 275 void doIt(); … … 283 294 int itsDataSize; 284 295 int itsSize; 285 int itsTagId;296 // int itsTagId; 286 297 int wakeUp; 287 298 299 DimCurrentInfo(){ 300 subscribe((char *)0, 0, (void *)0, 0); }; 288 301 DimCurrentInfo(const char *name, int nolink) { 289 302 subscribe((char *)name, 0, &nolink, sizeof(int)); }; … … 326 339 char *getString() { return (char *)getData(); } ; 327 340 int getSize() { getData(); return itsSize; } ; 341 void subscribe(char *name, void *nolink, int nolinksize, int time) 342 { subscribe((char *)name, time, nolink, nolinksize); }; 328 343 329 344 private : … … 337 352 public : 338 353 int itsId; 339 int itsTagId;354 // int itsTagId; 340 355 int itsInit; 341 356 void *itsData; -
trunk/FACT++/dim/dim/dim.h
r13339 r13995 14 14 #include "dim_common.h" 15 15 16 #define DIM_VERSION_NUMBER 1931 16 #define DIM_VERSION_NUMBER 1935 17 17 18 18 19 #define MY_LITTLE_ENDIAN 0x1 -
trunk/FACT++/dim/src/conn_handler.c
r11071 r13995 188 188 DISABLE_AST 189 189 190 if( id >= Curr_N_Ids)190 if((id >= Curr_N_Ids) || (id <= 0)) 191 191 { 192 192 ENABLE_AST -
trunk/FACT++/dim/src/dic.c
r13339 r13995 189 189 service_tmout( servp->serv_id ); 190 190 } 191 /* 191 192 servp->pending = WAITING_DNS_UP; 192 193 servp->conn_id = 0; 194 */ 193 195 auxp = servp->prev; 194 196 move_to_notok_service( servp ); … … 243 245 { 244 246 service_tmout( servp->serv_id ); 247 /* 245 248 servp->pending = WAITING_DNS_UP; 246 249 servp->conn_id = 0; 250 */ 247 251 move_to_notok_service( servp ); 248 252 } … … 553 557 if(servp->type == ONCE_ONLY) 554 558 once_only = 1; 559 /* 555 560 if( servp->fill_address ) 561 */ 562 if( servp->fill_size >= 0 ) 556 563 { 557 564 size = servp->fill_size; … … 748 755 if( (conn_id = servp->conn_id) ) 749 756 { 750 free( servp->fill_address ); 751 fillp = (int *)malloc(serv_size); 752 memcpy( (char *)fillp, (char *)serv_address, serv_size ); 757 if(servp->fill_size > 0) 758 free( servp->fill_address ); 759 fillp = 0; 760 if(serv_size > 0) 761 { 762 fillp = (int *)malloc(serv_size); 763 memcpy( (char *)fillp, (char *)serv_address, serv_size ); 764 } 753 765 servp->fill_address = fillp; 754 766 servp->fill_size = serv_size; … … 802 814 newp->user_routine = routine; 803 815 newp->tag = tag; 804 fillp = (int *)malloc(fill_size); 805 memcpy( (char *) fillp, (char *) fill_addr, fill_size ); 816 fillp = 0; 817 if(fill_size > 0) 818 { 819 fillp = (int *)malloc(fill_size); 820 memcpy( (char *) fillp, (char *) fill_addr, fill_size ); 821 } 806 822 newp->fill_address = fillp; 807 823 newp->fill_size = fill_size; … … 867 883 servp->user_routine = routine; 868 884 servp->tag = tag; 869 free( servp->fill_address ); 870 fillp = (int *)malloc(fill_size); 871 memcpy( (char *) fillp, (char *) fill_addr, fill_size ); 885 if(servp->fill_size > 0) 886 free( servp->fill_address ); 887 fillp = 0; 888 if(fill_size > 0) 889 { 890 fillp = (int *)malloc(fill_size); 891 memcpy( (char *) fillp, (char *) fill_addr, fill_size ); 892 } 872 893 servp->fill_address = fillp; 873 894 servp->fill_size = fill_size; … … 1082 1103 if(servicep->type != COMMAND) 1083 1104 */ 1084 free( servicep->fill_address ); 1105 if(servicep->fill_size > 0) 1106 free( servicep->fill_address ); 1085 1107 if(strstr(servicep->serv_name,"/RpcOut")) 1086 1108 { … … 1492 1514 if(tmout > 120) 1493 1515 tmout = 120; 1516 /* Can not be 0, the callback of dtq_start_timer(0) is not protected */ 1517 if(tmout == 0) 1518 tmout = 1; 1494 1519 dtq_start_timer(tmout, retry_bad_connection, (long)bad_connp); 1495 1520 if(( servp->type == COMMAND )||( servp->type == ONCE_ONLY )) … … 1555 1580 (DLL *) servp)) ) 1556 1581 { 1582 /* 1557 1583 servp->pending = WAITING_DNS_UP; 1558 1584 servp->conn_id = 0; 1585 */ 1559 1586 auxp = servp->prev; 1560 1587 move_to_notok_service( servp ); … … 1571 1598 if(Dic_conns[conn_id].service_head) 1572 1599 { 1600 DISABLE_AST 1601 /* 1602 printf("move_to_ok %s\n",servp->serv_name); 1603 */ 1573 1604 servp->pending = NOT_PENDING; 1574 1605 servp->tmout_done = 0; … … 1576 1607 dll_insert_queue( (DLL *) Dic_conns[conn_id].service_head, 1577 1608 (DLL *) servp ); 1609 ENABLE_AST 1578 1610 } 1579 1611 } … … 1581 1613 void move_to_bad_service( DIC_SERVICE *servp, DIC_BAD_CONNECTION *bad_connp) 1582 1614 { 1615 DISABLE_AST 1616 /* 1617 printf("move_to_bad %s\n",servp->serv_name); 1618 */ 1583 1619 servp->pending = WAITING_DNS_UP; 1584 1620 dll_remove( (DLL *) servp ); 1585 1621 dll_insert_queue( (DLL *) bad_connp->conn.service_head, (DLL *) servp ); 1622 ENABLE_AST 1586 1623 } 1587 1624 … … 1590 1627 /* 1591 1628 if(servp->pending != WAITING_CMND_ANSWER) 1629 */ 1630 DISABLE_AST 1631 /* 1632 printf("move_to_cmnd %s\n",servp->serv_name); 1592 1633 */ 1593 1634 servp->pending = NOT_PENDING; … … 1595 1636 dll_remove( (DLL *) servp ); 1596 1637 dll_insert_queue( (DLL *) Cmnd_head, (DLL *) servp ); 1638 ENABLE_AST 1597 1639 } 1598 1640 1599 1641 void move_to_notok_service(DIC_SERVICE *servp ) 1600 1642 { 1601 1643 DISABLE_AST 1644 /* 1645 printf("move_to_notok %s\n",servp->serv_name); 1646 */ 1647 servp->pending = WAITING_DNS_UP; 1648 servp->conn_id = 0; 1602 1649 dll_remove( (DLL *) servp ); 1603 1650 dll_insert_queue( (DLL *) Service_pend_head, (DLL *) servp ); 1651 ENABLE_AST 1604 1652 } 1605 1653 … … 1806 1854 move_to_ok_service( servp, conn_id ); 1807 1855 } 1856 else 1857 { 1858 if( servp->type == ONCE_ONLY ) 1859 { 1860 servp->pending = WAITING_DNS_UP; 1861 dic_release_service( servp->serv_id ); 1862 } 1863 else 1864 { 1865 servp->pending = WAITING_DNS_UP; 1866 servp->conn_id = 0; 1867 /* 1868 release_conn(conn_id); 1869 */ 1870 request_dns_info(0); 1871 } 1872 } 1808 1873 } 1809 1874 return(ret); … … 1834 1899 { 1835 1900 dim_print_date_time(); 1836 printf(" Client Sending Service Request: Couldn't write to Conn %3d : Server %s@%s \n",1837 conn_id, Net_conns[conn_id].task, Net_conns[conn_id].node );1901 printf(" Client Sending Service Request: Couldn't write to Conn %3d : Server %s@%s service %s\n", 1902 conn_id, Net_conns[conn_id].task, Net_conns[conn_id].node, servp->serv_name); 1838 1903 fflush(stdout); 1839 1904 } … … 1884 1949 1885 1950 size = servp->fill_size; 1951 1952 if(size < 0) 1953 return(1); 1886 1954 1887 1955 if( !cmnd_packet_size ) { -
trunk/FACT++/dim/src/diccpp.cxx
r12757 r13995 142 142 { 143 143 itsId = 0; 144 // itsTagId = 0;145 144 itsData = 0; 146 145 itsFormat = 0; 147 146 itsHandler = handler; 147 itsDataSize = 0; 148 itsSize = 0; 149 itsNolinkBuf = 0; 150 itsNolinkSize = 0; 151 itsName = 0; 152 if(!name) 153 { 154 return; 155 } 148 156 itsName = new char[strlen(name)+1]; 149 157 strcpy(itsName,name); 150 itsDataSize = 0; 151 itsSize = 0; 152 itsNolinkBuf = new char[nolinksize]; 153 itsNolinkSize = nolinksize; 154 memcpy(itsNolinkBuf, nolink, nolinksize); 158 if(nolinksize > 0) 159 { 160 itsNolinkBuf = new char[nolinksize]; 161 itsNolinkSize = nolinksize; 162 memcpy(itsNolinkBuf, nolink, nolinksize); 163 } 155 164 if(!time) 156 165 { … … 176 185 // if(itsTagId) 177 186 // id_free(itsTagId, SRC_DIC); 178 dic_release_service(itsId); 179 delete[] (char *)itsNolinkBuf; 187 if(itsId) 188 dic_release_service(itsId); 189 if(itsNolinkSize) 190 delete[] (char *)itsNolinkBuf; 180 191 if(itsDataSize) 181 192 delete[] (char *)itsData; 182 delete[] itsName; 193 if(itsName) 194 delete[] itsName; 183 195 if(itsFormat) 184 196 delete[] itsFormat; … … 215 227 { 216 228 itsId = 0; 229 itsData = 0; 217 230 itsFormat = 0; 218 231 itsHandler = handler; 232 itsDataSize = 0; 233 itsSize = 0; 234 itsNolinkBuf = 0; 235 itsNolinkSize = 0; 236 itsName = 0; 237 if(!name) 238 { 239 return; 240 } 219 241 itsName = new char[strlen(name)+1]; 220 242 strcpy(itsName,name); 221 itsDataSize = 0; 222 itsNolinkBuf = new char[nolinksize]; 223 itsNolinkSize = nolinksize; 224 memcpy(itsNolinkBuf, nolink, nolinksize); 243 if(nolinksize > 0) 244 { 245 itsNolinkBuf = new char[nolinksize]; 246 itsNolinkSize = nolinksize; 247 memcpy(itsNolinkBuf, nolink, nolinksize); 248 } 225 249 if(!time) 226 250 { … … 261 285 { 262 286 itsId = 0; 287 itsData = 0; 263 288 itsFormat = 0; 264 289 itsHandler = handler; 290 itsDataSize = 0; 291 itsSize = 0; 292 itsNolinkBuf = 0; 293 itsNolinkSize = 0; 294 itsName = 0; 295 if(!name) 296 { 297 return; 298 } 265 299 itsName = new char[strlen(name)+1]; 266 300 strcpy(itsName,name); 267 itsDataSize = 0; 268 itsNolinkBuf = new char[nolinksize]; 269 itsNolinkSize = nolinksize; 270 memcpy(itsNolinkBuf, nolink, nolinksize); 301 if(nolinksize > 0) 302 { 303 itsNolinkBuf = new char[nolinksize]; 304 itsNolinkSize = nolinksize; 305 memcpy(itsNolinkBuf, nolink, nolinksize); 306 } 271 307 if(!time) 272 308 { … … 325 361 326 362 // itsTagId = 0; 363 // itsId = 0; 364 itsData = 0; 365 // itsFormat = 0; 366 // itsHandler = handler; 367 itsDataSize = 0; 368 itsSize = 0; 369 itsNolinkBuf = 0; 370 itsNolinkSize = 0; 371 itsName = 0; 372 if(!name) 373 { 374 return; 375 } 376 itsName = new char[strlen(name)+1]; 377 strcpy(itsName,name); 378 if(nolinksize > 0) 379 { 380 itsNolinkBuf = new char[nolinksize]; 381 itsNolinkSize = nolinksize; 382 memcpy(itsNolinkBuf, nolink, nolinksize); 383 } 327 384 if(!time) 328 385 timeout = 10; 329 386 else 330 387 timeout = time; 331 itsName = new char[strlen(name)+1];332 strcpy(itsName,name);333 itsDataSize = 0;334 itsNolinkBuf = new char[nolinksize];335 itsNolinkSize = nolinksize;336 memcpy(itsNolinkBuf, nolink, nolinksize);337 388 wakeUp = 0; 338 389 // itsTagId = id_get((void *)this, SRC_DIC); … … 345 396 DimCurrentInfo::~DimCurrentInfo() 346 397 { 398 // if(itsId) 399 // dic_release_service(itsId); 400 if(itsNolinkSize) 401 delete[] (char *)itsNolinkBuf; 402 if(itsDataSize) 403 delete[] (char *)itsData; 404 if(itsName) 405 delete[] itsName; 406 // if(itsFormat) 407 // delete[] itsFormat; 408 /* 347 409 delete[] (char *)itsNolinkBuf; 348 410 … … 352 414 delete[] (char *)itsData; 353 415 delete[] itsName; 416 */ 354 417 } 355 418 -
trunk/FACT++/dim/src/dis.c
r13339 r13995 1560 1560 dis_packet->service_id = htovl(service_id); 1561 1561 dis_packet->size = htovl(DIS_HEADER); 1562 /* 1562 1563 if( !dna_write_nowait(reqp->conn_id, dis_packet, DIS_HEADER) ) 1564 Has to be dna_write otherwise the client gets the message much before the DNS 1565 */ 1566 if( !dna_write(reqp->conn_id, dis_packet, DIS_HEADER) ) 1563 1567 { 1564 1568 dim_print_date_time(); … … 2620 2624 } 2621 2625 } 2626 /* The client should close the connection (there may be commands) 2622 2627 if( dll_empty((DLL *)clip->requestp_head) ) 2623 2628 { 2624 2629 release_conn( conn_id, 0, 0 ); 2625 2630 } 2631 */ 2626 2632 } 2627 2633 ENABLE_AST -
trunk/FACT++/dim/src/tcpip.c
r13339 r13995 1312 1312 ret = WSAGetLastError(); 1313 1313 #endif 1314 /* 1315 if((wrote == -1) && (!tcpip_would_block(ret))) 1316 { 1317 dna_report_error(conn_id, 0, 1318 "Writing (non-blocking) to", DIM_ERROR, DIMTCPWRRTY); 1319 printf("Writing %d, ret = %d\n", size, ret); 1320 } 1321 */ 1314 1322 set_blocking(Net_conns[conn_id].channel); 1315 1323 if(wrote == -1) … … 1327 1335 if( wrote == -1 ) 1328 1336 { 1337 /* 1338 dna_report_error(conn_id, 0, 1339 "Writing to", DIM_ERROR, DIMTCPWRRTY); 1340 */ 1329 1341 return(0); 1330 1342 } … … 1333 1345 else 1334 1346 { 1347 /* 1348 dna_report_error(conn_id, 0, 1349 "Writing (non-blocking) to", DIM_ERROR, DIMTCPWRRTY); 1350 */ 1335 1351 return(0); 1336 1352 } -
trunk/FACT++/dim/src/util/dim_send_command.c
r11071 r13995 74 74 int silent = 0; 75 75 char data[1024] = {'\0'}; 76 int data_int, data_int_flag = 0; 76 77 char dns_node[128], *ptr; 77 78 int dns_port = 0; … … 95 96 silent = 1; 96 97 } 98 else if(!strcmp(argv[i],"-i")) 99 { 100 data_int_flag = 1; 101 } 97 102 else 98 103 { … … 102 107 } 103 108 else if(!data[0]) 109 { 104 110 strcpy(data,argv[i]); 111 } 105 112 } 106 113 } … … 116 123 { 117 124 printf("dim_send_command: Insufficient parameters\n"); 118 printf("usage: dim_send_command <cmnd_name> [<data>] [-dns <dns_node>] [-s] \n");125 printf("usage: dim_send_command <cmnd_name> [<data>] [-dns <dns_node>] [-s] [-i]\n"); 119 126 exit(0); 120 127 } 121 128 if(!data[0]) 122 129 data[0] = '\0'; 123 dic_cmnd_callback(str,data,strlen(data)+1, rout, silent); 130 if(data_int_flag) 131 { 132 sscanf(data,"%d",&data_int); 133 dic_cmnd_callback(str,&data_int,sizeof(int), rout, silent); 134 } 135 else 136 { 137 dic_cmnd_callback(str,data,strlen(data)+1, rout, silent); 138 } 124 139 while(!received) 125 140 dim_wait();
Note:
See TracChangeset
for help on using the changeset viewer.