Changeset 13135 for trunk/FACT++/dim/src/dis.c
- Timestamp:
- 03/18/12 20:53:49 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.