From: Robert W. <wrw...@us...> - 2006-12-13 19:46:01
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15329/src Modified Files: iSNSLinux.c iSNSList.c iSNScomm.c iSNSdereg.c iSNSesi.c iSNSparse.c iSNSquery.c iSNSreg.c iSNSscn.c iSNStrcv.c Log Message: Add more debug code Index: iSNScomm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNScomm.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNScomm.c 7 Dec 2006 00:12:03 -0000 1.7 --- iSNScomm.c 13 Dec 2006 19:45:57 -0000 1.8 *************** *** 110,114 **** void pipe_handler(int n) { ! printf("SIG_PIPE received:%i\n",n); } --- 110,114 ---- void pipe_handler(int n) { ! printf("SIGPIPE received:%i\n",n); } *************** *** 364,370 **** --- 364,377 ---- ISNSSendMsg(ISNS_Msg_Descp *p_md) { + char * attr_indx[SNS_MAX_ATTRS]; + char * key_indx[SNS_MAX_ATTRS]; int rval; + + DEBUG_0 (sns_comm_debug &1,ISNSSendMsg); + p_md->msg.hdr.flags |= ISNS_FLAG_SND_SERVER; + ISNSParseMsg(&p_md->msg, attr_indx, key_indx, NULL); + if (p_md->cb.sock.socketType==ISNS_SOCKET_TYPE_UDP) { Index: iSNSLinux.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSLinux.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSLinux.c 8 Dec 2006 20:05:50 -0000 1.9 --- iSNSLinux.c 13 Dec 2006 19:45:57 -0000 1.10 *************** *** 80,84 **** HANDLE init_ipc_rcv (void); ! void DebugOn (void); void --- 80,84 ---- HANDLE init_ipc_rcv (void); ! void DebugOn (char *); void *************** *** 154,158 **** while (optind != argc) { ! c = getopt (argc, argv, "fda:b:p:c:"); switch (c) --- 154,158 ---- while (optind != argc) { ! c = getopt (argc, argv, "fa:b:p:c:d:"); switch (c) *************** *** 180,184 **** case 'd': ! DebugOn(); break; case 'f': --- 180,184 ---- case 'd': ! DebugOn(optarg); break; case 'f': *************** *** 378,382 **** void ! DebugOn (void) { extern int sns_bcast_debug; --- 378,382 ---- void ! DebugOn (char * type) { extern int sns_bcast_debug; *************** *** 390,405 **** extern int sns_comm_debug; extern int isns_db_debug; extern int sns_parse_debug; ! sns_bcast_debug = -1; ! sns_cb_debug = -1; ! sns_comm_debug = -1; ! isns_db_debug = -1; ! sns_fsm_debug = -1; ! sns_hb_debug = -1; ! isns_main_debug = -1; ! sns_recv_debug = -1; ! sns_rsync_debug = -1; ! sns_scn_debug = -1; ! sns_parse_debug = -1; } --- 390,455 ---- extern int sns_comm_debug; extern int isns_db_debug; + extern int isns_list_debug; extern int sns_parse_debug; + extern int sns_tcp_debug; + extern int isns_query_debug; + extern int isns_reg_debug; + extern int isns_dereg_debug; + extern int isns_esi_debug; ! if (!strcmp(type,"parse")) ! { ! sns_parse_debug = -1; ! isns_main_debug = -1; ! sns_comm_debug = -1; ! sns_tcp_debug = -1; ! } ! else if (!strcmp(type,"db")) ! { ! isns_db_debug = -1; ! } ! else if (!strcmp(type,"list")) ! { ! isns_list_debug = -1; ! } ! else if (!strcmp(type,"reg")) ! { ! isns_reg_debug = -1; ! isns_dereg_debug = -1; ! isns_query_debug = -1; ! } ! else if (!strcmp(type,"fsm")) ! { ! sns_fsm_debug = -1; ! sns_hb_debug = -1; ! sns_cb_debug = -1; ! } ! else if (!strcmp(type,"esi")) ! { ! isns_esi_debug = -1; ! } ! else if (!strcmp(type,"scn")) ! { ! sns_scn_debug = -1; ! } ! else ! { ! sns_bcast_debug = -1; ! sns_cb_debug = -1; ! sns_comm_debug = -1; ! isns_db_debug = -1; ! sns_fsm_debug = -1; ! sns_hb_debug = -1; ! isns_main_debug = -1; ! sns_recv_debug = -1; ! sns_rsync_debug = -1; ! sns_scn_debug = -1; ! sns_parse_debug = -1; ! sns_tcp_debug = -1; ! isns_list_debug = -1; ! isns_query_debug = -1; ! isns_reg_debug = -1; ! isns_dereg_debug = -1; ! isns_esi_debug = -1; ! } } Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNSquery.c 12 Dec 2006 21:38:29 -0000 1.7 --- iSNSquery.c 13 Dec 2006 19:45:57 -0000 1.8 *************** *** 58,62 **** /* Global */ ! extern int isns_db_debug;; extern uint32_t isns_esi_interval; --- 58,62 ---- /* Global */ ! int isns_query_debug=0; extern uint32_t isns_esi_interval; *************** *** 149,153 **** if (attr == NULL) { ! DEBUG_0 (isns_db_debug & 1, (No attr in query msg)); return ( ISNS_MSG_FMT_ERR ); } --- 149,153 ---- if (attr == NULL) { ! DEBUG_0 (isns_query_debug & 1, (No attr in query msg)); return ( ISNS_MSG_FMT_ERR ); } *************** *** 272,276 **** iSCSINodeIdxKeyFlag = -1; ! DEBUG_0 (isns_db_debug &1,(GetAttrEntity)); ISNSTouchEntity( src_attr ); --- 272,276 ---- iSCSINodeIdxKeyFlag = -1; ! DEBUG_0 (isns_query_debug &1,(GetAttrEntity)); ISNSTouchEntity( src_attr ); *************** *** 345,349 **** /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); ! DEBUG_1 (isns_db_debug &1,(Find Entity Index:%i),key->val.index); ISNS_Key read_key; read_key.tag = ENTITY_IDX_KEY; --- 345,349 ---- /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); ! DEBUG_1 (isns_query_debug &1,(Find Entity Index:%i),key->val.index); ISNS_Key read_key; read_key.tag = ENTITY_IDX_KEY; *************** *** 355,359 **** ptr = (char *)&entry3.data.entity_idx.id; ! DEBUG_1 (isns_db_debug &1,(entity_idx.id:%s),ptr); if (!ptr) --- 355,359 ---- ptr = (char *)&entry3.data.entity_idx.id; ! DEBUG_1 (isns_query_debug &1,(entity_idx.id:%s),ptr); if (!ptr) *************** *** 643,655 **** else if (ddKeyIndex != -1) { ! DEBUG_0(isns_db_debug & 1, (Not implemented)); } else if (ifcpKeyIndex != -1) { ! DEBUG_0 (isns_db_debug & 1, (Not implemented)); } else if (iscsiKeyIndex != -1) { ! DEBUG_0 (isns_db_debug & 1, (Not implemented)); } else --- 643,655 ---- else if (ddKeyIndex != -1) { ! DEBUG_0(isns_query_debug & 1, (Not implemented)); } else if (ifcpKeyIndex != -1) { ! DEBUG_0 (isns_query_debug & 1, (Not implemented)); } else if (iscsiKeyIndex != -1) { ! DEBUG_0 (isns_query_debug & 1, (Not implemented)); } else *************** *** 1228,1232 **** if (rval != SUCCESS) { ! DEBUG_0(isns_db_debug & 1, "***ERROR Invalid dd"); return (ISNS_NO_SUCH_ENTRY_ERR); } --- 1228,1232 ---- if (rval != SUCCESS) { ! DEBUG_0(isns_query_debug & 1, "***ERROR Invalid dd"); return (ISNS_NO_SUCH_ENTRY_ERR); } *************** *** 1534,1538 **** else if (fc4TypesKeyFlag != -1) { ! DEBUG_0 (isns_db_debug & 1, (Not Implemented)); return (ERROR); } --- 1534,1538 ---- else if (fc4TypesKeyFlag != -1) { ! DEBUG_0 (isns_query_debug & 1, (Not Implemented)); return (ERROR); } *************** *** 1588,1592 **** int rval; ! DEBUG_1 (isns_db_debug &1,(Attribute Query - ISCSI:%s),(char *)&src_attr->val); foundFlag = FALSE; --- 1588,1592 ---- int rval; ! DEBUG_1 (isns_query_debug &1,(Attribute Query - ISCSI:%s),(char *)&src_attr->val); foundFlag = FALSE; *************** *** 1635,1639 **** if (nodeKeyIndex != -1) { ! DEBUG_0 (isns_db_debug &1,nodeKeyIndex); nodeKeyIndex = ISNSFindTag (0, ISNS_ISCSI_NODE_ID, key_indx); --- 1635,1639 ---- if (nodeKeyIndex != -1) { ! DEBUG_0 (isns_query_debug &1,nodeKeyIndex); nodeKeyIndex = ISNSFindTag (0, ISNS_ISCSI_NODE_ID, key_indx); *************** *** 1657,1661 **** if (rval == SUCCESS) { ! DEBUG_0 (isns_db_debug &1,call ISNSdbProcessICSCIOpAttr); ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); foundFlag = TRUE; --- 1657,1661 ---- if (rval == SUCCESS) { ! DEBUG_0 (isns_query_debug &1,call ISNSdbProcessICSCIOpAttr); ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); foundFlag = TRUE; *************** *** 1759,1763 **** SOIP_Portal * p_portal; ! DEBUG_0 (isns_db_debug &1,(Search for Portal)); memset (&db_portal, 0, sizeof (db_portal)); --- 1759,1763 ---- SOIP_Portal * p_portal; ! DEBUG_0 (isns_query_debug &1,(Search for Portal)); memset (&db_portal, 0, sizeof (db_portal)); *************** *** 1838,1842 **** ISNS_Key qkey = { 0 }; ! DEBUG_0 (isns_db_debug &1,search node table); /* Search the node table */ --- 1838,1842 ---- ISNS_Key qkey = { 0 }; ! DEBUG_0 (isns_query_debug &1,search node table); /* Search the node table */ *************** *** 1878,1882 **** return (ISNS_NO_SUCH_ENTRY_ERR); ! DEBUG_0 (isns_db_debug &1,return from GetAttrISCSI); return ISNS_NO_ERR; --- 1878,1882 ---- return (ISNS_NO_SUCH_ENTRY_ERR); ! DEBUG_0 (isns_query_debug &1,return from GetAttrISCSI); return ISNS_NO_ERR; *************** *** 1909,1913 **** int rval; ! DEBUG_0 (isns_db_debug &1, (ISNSGetNextAttr)); ISNSParseMsg( &p_md->msg, attr_indx, key_indx,&src_attr ); --- 1909,1913 ---- int rval; ! DEBUG_0 (isns_query_debug &1, (ISNSGetNextAttr)); ISNSParseMsg( &p_md->msg, attr_indx, key_indx,&src_attr ); *************** *** 1928,1932 **** { key = (ISNS_Key *)(key_indx[ii]); ! DEBUG_2 (isns_db_debug &1,(keytag:%i (%s)),key->tag,isnsTagText(key->tag)); switch (key->tag) { --- 1928,1932 ---- { key = (ISNS_Key *)(key_indx[ii]); ! DEBUG_2 (isns_query_debug &1,(keytag:%i (%s)),key->tag,isnsTagText(key->tag)); switch (key->tag) { *************** *** 2052,2056 **** else if ( nodeKeyIndex != -1 || iscsiIdxKeyIndex!=-1 ) { ! DEBUG_0 (isns_db_debug &1,process nodeKeyIndex); memset(&qkey, 0, sizeof(qkey)); qkey.tag = ISCSI_ID_KEY; --- 2052,2056 ---- else if ( nodeKeyIndex != -1 || iscsiIdxKeyIndex!=-1 ) { ! DEBUG_0 (isns_query_debug &1,process nodeKeyIndex); memset(&qkey, 0, sizeof(qkey)); qkey.tag = ISCSI_ID_KEY; *************** *** 2058,2065 **** if ( nodeKeyIndex !=-1 ) { ! DEBUG_1 (isns_db_debug &1,(nodeKeyIndex:%i),nodeKeyIndex); key=(ISNS_Key *)(key_indx[nodeKeyIndex]); ! DEBUG_1 (isns_db_debug &1,key length:%i,key->len); ! DEBUG_1 (isns_db_debug &1,key:%s,(char *)&key->val); if (key->len) { --- 2058,2065 ---- if ( nodeKeyIndex !=-1 ) { ! DEBUG_1 (isns_query_debug &1,(nodeKeyIndex:%i),nodeKeyIndex); key=(ISNS_Key *)(key_indx[nodeKeyIndex]); ! DEBUG_1 (isns_query_debug &1,key length:%i,key->len); ! DEBUG_1 (isns_query_debug &1,key:%s,(char *)&key->val); if (key->len) { *************** *** 2097,2102 **** while (!found) { ! DEBUG_1 (isns_db_debug &1, (GetNextOfKey:%s),(char *)&qkey.val); ! DEBUG_1 (isns_db_debug &1, (GetNextOfKey length:%i),qkey.len); if (SNSdbGetNextOfKey (&qkey) != SUCCESS) { --- 2097,2102 ---- while (!found) { ! DEBUG_1 (isns_query_debug &1, (GetNextOfKey:%s),(char *)&qkey.val); ! DEBUG_1 (isns_query_debug &1, (GetNextOfKey length:%i),qkey.len); if (SNSdbGetNextOfKey (&qkey) != SUCCESS) { *************** *** 2106,2110 **** if (rval != SUCCESS) { ! DEBUG_0 (isns_db_debug &1,(ERROR reading Key)); return rval; } --- 2106,2110 ---- if (rval != SUCCESS) { ! DEBUG_0 (isns_query_debug &1,(ERROR reading Key)); return rval; } *************** *** 2221,2225 **** if (rval != SUCCESS) { ! DEBUG_0 (isns_db_debug &1,(Error reading getnext)); return 0; } --- 2221,2225 ---- if (rval != SUCCESS) { ! DEBUG_0 (isns_query_debug &1,(Error reading getnext)); return 0; } *************** *** 2304,2308 **** if (rval != SUCCESS) { ! DEBUG_0 (isns_db_debug &1,(getnextkey error)); } --- 2304,2308 ---- if (rval != SUCCESS) { ! DEBUG_0 (isns_query_debug &1,(getnextkey error)); } *************** *** 2758,2765 **** { q_attr = (ISNS_Attr *) attr_indx[ ii ]; switch ( q_attr->tag ) { case ISNS_ISCSI_NODE_ID: ! DEBUG_1 (isns_db_debug &1,ISCSI NODE ID %s,p_node->id.v); ISNSAppendAttr ( p_msg, ISNS_ISCSI_NODE_ID, PAD4 (strlen (p_node->id.v)), p_node->id.v, 0 ); --- 2758,2767 ---- { q_attr = (ISNS_Attr *) attr_indx[ ii ]; + + DEBUG_1 (isns_query_debug &1, process attribute for iscsi and entity objects (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) { case ISNS_ISCSI_NODE_ID: ! DEBUG_1 (isns_query_debug &1,ISCSI NODE ID %s,p_node->id.v); ISNSAppendAttr ( p_msg, ISNS_ISCSI_NODE_ID, PAD4 (strlen (p_node->id.v)), p_node->id.v, 0 ); *************** *** 2852,2861 **** if ( fetchPortalFlag ) { ! DEBUG_0 (isns_db_debug &1, (fetchPortalFlag)); /* Cycle through all portal */ pnode = NULL; while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) ) { ! DEBUG_0 (isns_db_debug &1, get portal); ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; --- 2854,2863 ---- if ( fetchPortalFlag ) { ! DEBUG_0 (isns_query_debug &1, (fetchPortalFlag)); /* Cycle through all portal */ pnode = NULL; while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) ) { ! DEBUG_0 (isns_query_debug &1, get portal); ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; *************** *** 2870,2874 **** { q_attr = (ISNS_Attr *) attr_indx[jj]; ! DEBUG_0 (isns_db_debug &1, process attribute list); switch ( q_attr->tag ) --- 2872,2876 ---- { q_attr = (ISNS_Attr *) attr_indx[jj]; ! DEBUG_1 (isns_query_debug &1, process attribute for portal object (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) *************** *** 2880,2884 **** break; case ISNS_PORTAL_IP: ! DEBUG_0 (isns_db_debug &1,Add ISNS_PORTAL_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_IP, ISNS_PORTAL_IP_SIZE, p_portal->ip_addr.v, 0); --- 2882,2886 ---- break; case ISNS_PORTAL_IP: ! DEBUG_0 (isns_query_debug &1,Add ISNS_PORTAL_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_IP, ISNS_PORTAL_IP_SIZE, p_portal->ip_addr.v, 0); *************** *** 3285,3293 **** pnode = NULL; ! DEBUG_0 (isns_db_debug &1,(Get_Active_DD_list)); while ( (pnode=GetNextNode(dd_list, pnode)) ) { ! DEBUG_0 (isns_db_debug &1,(Get_Active_DD_List - node data)); /* First, look at the Node's Local DD_LIST. */ if (flag) --- 3287,3295 ---- pnode = NULL; ! DEBUG_0 (isns_query_debug &1,(Get_Active_DD_list)); while ( (pnode=GetNextNode(dd_list, pnode)) ) { ! DEBUG_0 (isns_query_debug &1,(Get_Active_DD_List - node data)); /* First, look at the Node's Local DD_LIST. */ if (flag) *************** *** 3491,3495 **** else { ! DEBUG_0(isns_db_debug & 1, (ISNSTouchEntity(): Not implemented)); return (ERROR); } --- 3493,3497 ---- else { ! DEBUG_0(isns_query_debug & 1, (ISNSTouchEntity(): Not implemented)); return (ERROR); } *************** *** 3559,3568 **** memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_db_debug &1, Get_Active_DD_List); Get_Active_DD_List (&pnode->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_db_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } --- 3561,3570 ---- memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_query_debug &1, Get_Active_DD_List); Get_Active_DD_List (&pnode->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } *************** *** 3583,3587 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_db_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } --- 3585,3589 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } *************** *** 3610,3614 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_db_debug & 1, "***ERROR: Invalid DD"); return (ISNS_NO_SUCH_ENTRY_ERR); } --- 3612,3616 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR: Invalid DD"); return (ISNS_NO_SUCH_ENTRY_ERR); } *************** *** 3623,3632 **** memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_db_debug &1, Get_Active_DD_List); Get_Active_DD_List (&p_port->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_db_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } --- 3625,3634 ---- memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_query_debug &1, Get_Active_DD_List); Get_Active_DD_List (&p_port->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } Index: iSNSList.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSList.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNSList.c 8 Dec 2006 20:05:50 -0000 1.7 --- iSNSList.c 13 Dec 2006 19:45:57 -0000 1.8 *************** *** 39,43 **** #include "iSNSdebug.h" ! extern int isns_db_debug; /******************************************************************** --- 39,43 ---- #include "iSNSdebug.h" ! int isns_list_debug = 0; /******************************************************************** *************** *** 164,169 **** plist->node_count = 0; ! DEBUG_1 (isns_db_debug &1,InitList list_id:%i,plist->list_id); ! DEBUG_1 (isns_db_debug &1,InitList node_count:%i,plist->node_count); return ( SUCCESS ); --- 164,169 ---- plist->node_count = 0; ! DEBUG_1 (isns_list_debug &1,InitList list_id:%i,plist->list_id); ! DEBUG_1 (isns_list_debug &1,InitList node_count:%i,plist->node_count); return ( SUCCESS ); *************** *** 178,182 **** ISNS_LIST_NODE pnode; ! DEBUG_1 (isns_db_debug &1,DeleteList list_id:%i,plist->list_id); while (!IsEmptyList(plist)) --- 178,182 ---- ISNS_LIST_NODE pnode; ! DEBUG_1 (isns_list_debug &1,DeleteList list_id:%i,plist->list_id); while (!IsEmptyList(plist)) *************** *** 212,216 **** ! DEBUG_0 (isns_db_debug &1,Remove Node); foundFlag = FALSE; --- 212,216 ---- ! DEBUG_0 (isns_list_debug &1,Remove Node); foundFlag = FALSE; *************** *** 220,224 **** while ( curr_node != NULL ) { ! DEBUG_2 (isns_db_debug &1, curr_node:%i pnode:%i,curr_node->index,pnode->index); if (curr_node->index == pnode->index ) { --- 220,224 ---- while ( curr_node != NULL ) { ! DEBUG_2 (isns_list_debug &1, curr_node:%i pnode:%i,curr_node->index,pnode->index); if (curr_node->index == pnode->index ) { *************** *** 231,243 **** if ( (curr_node == NULL) && (plist->node_count > 0) ) { ! DEBUG_1 (isns_db_debug &1,Remove Node FAILURE node_count:%i,plist->node_count); plist->node_count--; return ERROR; /* we should have found a node in this case */ } ! DEBUG_1 (isns_db_debug &1, Remove Node FoundFlag: %i,foundFlag); if ( foundFlag ) { ! DEBUG_0 (isns_db_debug &1, FoundFlag); /* read current node */ --- 231,243 ---- if ( (curr_node == NULL) && (plist->node_count > 0) ) { ! DEBUG_1 (isns_list_debug &1,Remove Node FAILURE node_count:%i,plist->node_count); plist->node_count--; return ERROR; /* we should have found a node in this case */ } ! DEBUG_1 (isns_list_debug &1, Remove Node FoundFlag: %i,foundFlag); if ( foundFlag ) { ! DEBUG_0 (isns_list_debug &1, FoundFlag); /* read current node */ *************** *** 348,352 **** /*update node_count*/ ! DEBUG_1 (isns_db_debug &1, RemoveNode - node_count:%i,plist->node_count); plist->node_count--; } --- 348,352 ---- /*update node_count*/ ! DEBUG_1 (isns_list_debug &1, RemoveNode - node_count:%i,plist->node_count); plist->node_count--; } *************** *** 361,365 **** GetNodeData(ISNS_LIST_NODE *pnode ) { ! DEBUG_0 (isns_db_debug &1, GetNodeData); return ( pnode->data ); } --- 361,365 ---- GetNodeData(ISNS_LIST_NODE *pnode ) { ! DEBUG_0 (isns_list_debug &1, GetNodeData); return ( pnode->data ); } *************** *** 373,377 **** ISNS_LIST_NODE *ptr; ! DEBUG_0 (isns_db_debug &1,FindNode); ptr = NULL; --- 373,377 ---- ISNS_LIST_NODE *ptr; ! DEBUG_0 (isns_list_debug &1,FindNode); ptr = NULL; *************** *** 406,410 **** SOIP_Fc_Node *p_ifcp; ! DEBUG_1 (isns_db_debug &1, AddNode - list_id:%i,plist->list_id); memset(&key,0,sizeof(ISNS_Key)); --- 406,410 ---- SOIP_Fc_Node *p_ifcp; ! DEBUG_1 (isns_list_debug &1, AddNode - list_id:%i,plist->list_id); memset(&key,0,sizeof(ISNS_Key)); *************** *** 484,488 **** } ! DEBUG_0 (isns_db_debug &1, update last_index); plist->last_index++; --- 484,488 ---- } ! DEBUG_0 (isns_list_debug &1, update last_index); plist->last_index++; *************** *** 508,512 **** plist->node_count++; ! DEBUG_1 (isns_db_debug &1, AddNode node_count:%i,plist->node_count); return ( SUCCESS ); --- 508,512 ---- plist->node_count++; ! DEBUG_1 (isns_list_debug &1, AddNode node_count:%i,plist->node_count); return ( SUCCESS ); *************** *** 519,523 **** IsEmptyList(ISNS_LIST *plist) { ! DEBUG_1 (isns_db_debug &1,IsEmptyList node_count:%i,plist->node_count); if (plist->node_count == 0) --- 519,523 ---- IsEmptyList(ISNS_LIST *plist) { ! DEBUG_1 (isns_list_debug &1,IsEmptyList node_count:%i,plist->node_count); if (plist->node_count == 0) *************** *** 546,550 **** ISNS_LIST *p_list; ! DEBUG_2 (isns_db_debug &1,GetNextNode list_id:%i node_count:%i, plist->list_id,plist->node_count); if (!plist || plist->node_count == 0) --- 546,550 ---- ISNS_LIST *p_list; ! DEBUG_2 (isns_list_debug &1,GetNextNode list_id:%i node_count:%i, plist->list_id,plist->node_count); if (!plist || plist->node_count == 0) *************** *** 560,569 **** if ( pnode == NULL) { ! DEBUG_0 (isns_db_debug &1, AllocBuffer for first node); node = (ISNS_LIST_NODE *)ISNSAllocBuffer(sizeof(ISNS_LIST_NODE)); key.val.list.list_index = plist->first_index; if (key.val.list.list_index == 0 ) { ! DEBUG_0 (isns_db_debug &1,Error condition node count>0 but first_index is 0); plist->node_count = 0; return NULL; --- 560,569 ---- if ( pnode == NULL) { ! DEBUG_0 (isns_list_debug &1, AllocBuffer for first node); node = (ISNS_LIST_NODE *)ISNSAllocBuffer(sizeof(ISNS_LIST_NODE)); key.val.list.list_index = plist->first_index; if (key.val.list.list_index == 0 ) { ! DEBUG_0 (isns_list_debug &1,Error condition node count>0 but first_index is 0); plist->node_count = 0; return NULL; *************** *** 573,577 **** { node = pnode; ! DEBUG_1 (isns_db_debug &1, next_index:%i,node->next_index); key.val.list.list_index = node->next_index; } --- 573,577 ---- { node = pnode; ! DEBUG_1 (isns_list_debug &1, next_index:%i,node->next_index); key.val.list.list_index = node->next_index; } *************** *** 579,592 **** if (key.val.list.list_index == 0) { ! DEBUG_0 (isns_db_debug &1, No More Entries in list); return NULL; } ! DEBUG_0 (isns_db_debug &1,Now Read entry); if (plist->list_id == ENTITY_ISCSI_LIST) { p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! DEBUG_0 (isns_db_debug &1, read list entry); rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) --- 579,592 ---- if (key.val.list.list_index == 0) { ! DEBUG_0 (isns_list_debug &1, No More Entries in list); return NULL; } ! DEBUG_0 (isns_list_debug &1,Now Read entry); if (plist->list_id == ENTITY_ISCSI_LIST) { p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! DEBUG_0 (isns_list_debug &1, read list entry); rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) *************** *** 598,602 **** node->data = (char *)ISNSAllocBuffer(node->data_size+1); memcpy(node->data,entry.data.list.key.node_name.v,node->data_size); ! DEBUG_0 (isns_db_debug &1, Successfully read list entry); } else if (plist->list_id == ENTITY_FCP_LIST) --- 598,602 ---- node->data = (char *)ISNSAllocBuffer(node->data_size+1); memcpy(node->data,entry.data.list.key.node_name.v,node->data_size); ! DEBUG_0 (isns_list_debug &1, Successfully read list entry); } else if (plist->list_id == ENTITY_FCP_LIST) *************** *** 740,744 **** node->p_entry = plist->p_entry; ! DEBUG_0 (isns_db_debug &1, return GetNextNode node); return node; } --- 740,744 ---- node->p_entry = plist->p_entry; ! DEBUG_0 (isns_list_debug &1, return GetNextNode node); return node; } Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSesi.c 6 Nov 2006 18:04:38 -0000 1.3 --- iSNSesi.c 13 Dec 2006 19:45:57 -0000 1.4 *************** *** 33,37 **** /* ! * This file contains source code for managing the SCN - state change notification. * */ --- 33,37 ---- /* ! * This file contains source code for managing the ESI - Entity State Inquiry. * */ *************** *** 53,60 **** /* Global */ ! uint32_t isns_esi_interval = 15; extern int sns_esi_interval; - extern int isns_db_debug; extern int sns_heartbeat_interval; --- 53,60 ---- /* Global */ ! int isns_esi_debug=0; + uint32_t isns_esi_interval = 15; extern int sns_esi_interval; extern int sns_heartbeat_interval; *************** *** 163,167 **** } ! DEBUG_1 (isns_db_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); --- 163,167 ---- } ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); *************** *** 308,312 **** if (i == -1) { ! DEBUG_0 (isns_db_debug & 1, (Entity ID tag not found in msg)); return ( ERROR ); } --- 308,312 ---- if (i == -1) { ! DEBUG_0 (isns_esi_debug & 1, (Entity ID tag not found in msg)); return ( ERROR ); } *************** *** 340,344 **** if ( i == -1 ) { ! DEBUG_0 (isns_db_debug & 1, (Portal IP tag not found in msg)); return ( ERROR ); } --- 340,344 ---- if ( i == -1 ) { ! DEBUG_0 (isns_esi_debug & 1, (Portal IP tag not found in msg)); return ( ERROR ); } *************** *** 350,354 **** if (i == -1) { ! DEBUG_0 (isns_db_debug & 1, (Portal PORT tag not found in msg)); return ( ERROR ); } --- 350,354 ---- if (i == -1) { ! DEBUG_0 (isns_esi_debug & 1, (Portal PORT tag not found in msg)); return ( ERROR ); } Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSparse.c 8 Dec 2006 20:20:34 -0000 1.9 --- iSNSparse.c 13 Dec 2006 19:45:57 -0000 1.10 *************** *** 102,105 **** --- 102,106 ---- case ISNS_DD_GET_NXT_ISCSI_MEMBER_REQ: case ISNS_ENTITY_GET_NXT_PORTAL_REQ: + case ISNS_DEV_ATTR_QRY_RES: parse_status = ISNSProfileKeysAttr (msg, attr_index, &num_attrs, key_index, &num_keys, (ISNS_Attr **)src_attr); *************** *** 136,140 **** case ISNS_DELIMITER: if (len != ISNS_DELIMITER_SIZE) ! rval = FALSE; DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; --- 137,141 ---- case ISNS_DELIMITER: if (len != ISNS_DELIMITER_SIZE) ! rval = FALSE; DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; *************** *** 283,287 **** return (ERROR); ! DEBUG_1(sns_parse_debug &1,message hdr flags:%x,msg->hdr.flags); /* Store Keys */ --- 284,288 ---- return (ERROR); ! DEBUG_2 (sns_parse_debug &1,%s flags:%x,FuncIDText(msg->hdr.type),msg->hdr.flags); /* Store Keys */ *************** *** 302,306 **** } ! if (msg->hdr.type == ISNS_ESI_RSP) { offset += 4; --- 303,308 ---- } ! if (msg->hdr.type == ISNS_ESI_RSP || msg->hdr.type == ISNS_REG_DEV_ATTR_RES || ! msg->hdr.type == ISNS_DEV_ATTR_QRY_RES) { offset += 4; Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNSdereg.c 8 Dec 2006 20:20:34 -0000 1.11 --- iSNSdereg.c 13 Dec 2006 19:45:57 -0000 1.12 *************** *** 59,63 **** /* Global */ ! extern int isns_db_debug;; extern uint32_t isns_esi_interval; --- 59,63 ---- /* Global */ ! int isns_dereg_debug;; extern uint32_t isns_esi_interval; *************** *** 228,232 **** ! DEBUG_0 (isns_db_debug &1, RemoveAttrDSS_Entry); dds_key.id = id; --- 228,232 ---- ! DEBUG_0 (isns_dereg_debug &1, RemoveAttrDSS_Entry); dds_key.id = id; *************** *** 315,319 **** if ( ISNSdbDelete (&delete_key) != SUCCESS) { ! DEBUG_1 (isns_db_debug & 1, (DDS Removal failed, %u), dds_key.id); return (ISNS_UNKNOWN_ERR); } --- 315,319 ---- if ( ISNSdbDelete (&delete_key) != SUCCESS) { ! DEBUG_1 (isns_dereg_debug & 1, (DDS Removal failed, %u), dds_key.id); return (ISNS_UNKNOWN_ERR); } *************** *** 349,353 **** /* int isActiveFlag; */ ! DEBUG_0 (isns_db_debug &1, RemoveAttrDDS_Member); dds_key.id = id; --- 349,353 ---- /* int isActiveFlag; */ ! DEBUG_0 (isns_dereg_debug &1, RemoveAttrDDS_Member); dds_key.id = id; *************** *** 465,469 **** char *key_indx[SNS_MAX_ATTRS]; ! DEBUG_0 (isns_db_debug & 1, "Entering RemoveAttrDDS()\n"); ISNSParseMsg(&p_md->msg, attr_indx, key_indx, &src_attr); --- 465,469 ---- char *key_indx[SNS_MAX_ATTRS]; ! DEBUG_0 (isns_dereg_debug & 1, "Entering RemoveAttrDDS()\n"); ISNSParseMsg(&p_md->msg, attr_indx, key_indx, &src_attr); *************** *** 497,501 **** if (keyRemovedFlag != TRUE) { ! DEBUG_0 (isns_db_debug & 1, (No DDS deregistered)); return (ISNS_UNKNOWN_ERR); } --- 497,501 ---- if (keyRemovedFlag != TRUE) { ! DEBUG_0 (isns_dereg_debug & 1, (No DDS deregistered)); return (ISNS_UNKNOWN_ERR); } *************** *** 554,558 **** if (FALSE == flag) { ! DEBUG_0 (isns_db_debug & 1, (Key not found)); return (ISNS_MSG_FMT_ERR); } --- 554,558 ---- if (FALSE == flag) { ! DEBUG_0 (isns_dereg_debug & 1, (Key not found)); return (ISNS_MSG_FMT_ERR); } *************** *** 575,579 **** ISNS_Key key; ! DEBUG_1 ( isns_db_debug & 1, (Deregistering Entity %s),p_entity_id); /* --- 575,579 ---- ISNS_Key key; ! DEBUG_1 ( isns_dereg_debug & 1, (Deregistering Entity %s),p_entity_id); /* *************** *** 592,596 **** /* Remove Portals */ ! DEBUG_0 (isns_db_debug &1,Remove iportal_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->iportal_list, pnode))) --- 592,596 ---- /* Remove Portals */ ! DEBUG_0 (isns_dereg_debug &1,Remove iportal_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->iportal_list, pnode))) *************** *** 604,608 **** { /* Remove IFCP Nodes */ ! DEBUG_0 (isns_db_debug &1,Remove ifcp_node_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->ifcp_node_list, pnode))) --- 604,608 ---- { /* Remove IFCP Nodes */ ! DEBUG_0 (isns_dereg_debug &1,Remove ifcp_node_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->ifcp_node_list, pnode))) *************** *** 615,623 **** { /* Remove ISCSI Nodes */ ! DEBUG_0 (isns_db_debug &1,Remove iscsi_node_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->iscsi_node_list, pnode))) { ! DEBUG_0 (isns_db_debug &1, Call SNSRemoveISCSINodeEntry); rval = SNSRemoveISCSINodeEntry (GetNodeData(pnode), NULL, p_rspmsg); if (rval) --- 615,623 ---- { /* Remove ISCSI Nodes */ ! DEBUG_0 (isns_dereg_debug &1,Remove iscsi_node_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->iscsi_node_list, pnode))) { ! DEBUG_0 (isns_dereg_debug &1, Call SNSRemoveISCSINodeEntry); rval = SNSRemoveISCSINodeEntry (GetNodeData(pnode), NULL, p_rspmsg); if (rval) *************** *** 628,632 **** else { ! DEBUG_1 (isns_db_debug & 1, (Entity Type invalid %u), p_entity->eid_type); } --- 628,632 ---- else { ! DEBUG_1 (isns_dereg_debug & 1, (Entity Type invalid %u), p_entity->eid_type); } *************** *** 671,675 **** ISNS_Key delete_key; ! DEBUG_0 (isns_db_debug & 1, (Deregistering IFCP WWPN)); /* --- 671,675 ---- ISNS_Key delete_key; ! DEBUG_0 (isns_dereg_debug & 1, (Deregistering IFCP WWPN)); /* *************** *** 969,973 **** if (nodeKeyIndex == -1) { ! DEBUG_0 (isns_db_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } --- 969,973 ---- if (nodeKeyIndex == -1) { ! DEBUG_0 (isns_dereg_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } *************** *** 1001,1005 **** if (FCNodeKeyIndex == -1) { ! DEBUG_0 (isns_db_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } --- 1001,1005 ---- if (FCNodeKeyIndex == -1) { ! DEBUG_0 (isns_dereg_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } *************** *** 1034,1038 **** if (entityKeyIndex == -1) { ! DEBUG_0 (isns_db_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } --- 1034,1038 ---- if (entityKeyIndex == -1) { ! DEBUG_0 (isns_dereg_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } *************** *** 1069,1073 **** ISNS_Key remove_key; ! DEBUG_0 (isns_db_debug & 1, (Deregistering iSCSI Node)); scn_bitmap = 0; --- 1069,1073 ---- ISNS_Key remove_key; ! DEBUG_0 (isns_dereg_debug & 1, (Deregistering iSCSI Node)); scn_bitmap = 0; *************** *** 1173,1177 **** if (rval != SUCCESS) { ! DEBUG_1 (isns_db_debug & 1, (ISCSI NODE Removal failed %s), iscsi_node_key); return (ERROR); } --- 1173,1177 ---- if (rval != SUCCESS) { ! DEBUG_1 (isns_dereg_debug & 1, (ISCSI NODE Removal failed %s), iscsi_node_key); return (ERROR); } *************** *** 1196,1200 **** ISNS_Key read_key; ! DEBUG_0 (isns_db_debug & 1, (Deregistering FC Node)); memset (&db_node_name, 0, sizeof (db_node_name)); --- 1196,1200 ---- ISNS_Key read_key; ! DEBUG_0 (isns_dereg_debug & 1, (Deregistering FC Node)); memset (&db_node_name, 0, sizeof (db_node_name)); *************** *** 1255,1259 **** ISNS_Key delete_key; ! DEBUG_0 (isns_db_debug & 1, (Deregistering Portal)); ISNS_Key read_key; --- 1255,1259 ---- ISNS_Key delete_key; ! DEBUG_0 (isns_dereg_debug & 1, (Deregistering Portal)); ISNS_Key read_key; *************** *** 1501,1505 **** if ( ISNSdbDelete(&delete_key) == ERROR ) { ! DEBUG_1 ( isns_db_debug & 1, (DD Removal failed %u), dd_key.id ); return ( ERROR ); } --- 1501,1505 ---- if ( ISNSdbDelete(&delete_key) == ERROR ) { ! DEBUG_1 ( isns_dereg_debug & 1, (DD Removal failed %u), dd_key.id ); return ( ERROR ); } *************** *** 1778,1782 **** else { ! DEBUG_1(isns_db_debug & 1, (SCN node type wrong: %u), type); return (ERROR); } --- 1778,1782 ---- else { ! DEBUG_1(isns_dereg_debug & 1, (SCN node type wrong: %u), type); return (ERROR); } *************** *** 1952,1956 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid key in SCN request)); return (ISNS_MSG_FMT_ERR); } --- 1952,1956 ---- else { ! DEBUG_0 (isns_dereg_debug & 1, (No valid key in SCN request)); return (ISNS_MSG_FMT_ERR); } Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSreg.c 8 Dec 2006 20:20:34 -0000 1.10 --- iSNSreg.c 13 Dec 2006 19:45:57 -0000 1.11 *************** *** 60,64 **** /* Global */ ! extern int isns_db_debug;; extern uint32_t isns_esi_interval; --- 60,64 ---- /* Global */ ! int isns_reg_debug=0; extern uint32_t isns_esi_interval; [...1236 lines suppressed...] /* Add DD to DDS */ --- 3683,3687 ---- p_dd->activeFlag = p_dds->status; rval = ISNSdbWrite(&dd_key,lentry2); ! DEBUG_1 (isns_reg_debug &1,Create Default DD rval:%i,rval); /* Add DD to DDS */ *************** *** 3724,3728 **** p_node->activeFlag = TRUE; ! DEBUG_1 (isns_db_debug &1,Add_DD_to_ISCSI_Node rval:%i,rval); Add_DD_Member(p_dd,p_node->id.v,PAD4(strlen(p_node->id.v)),ISNS_DD_ISCSI_MEMBER,ISNS_DD_MEMBER_ENABLE,0); ISNSdbWrite(&dd_key,lentry2); --- 3724,3728 ---- p_node->activeFlag = TRUE; ! DEBUG_1 (isns_reg_debug &1,Add_DD_to_ISCSI_Node rval:%i,rval); Add_DD_Member(p_dd,p_node->id.v,PAD4(strlen(p_node->id.v)),ISNS_DD_ISCSI_MEMBER,ISNS_DD_MEMBER_ENABLE,0); ISNSdbWrite(&dd_key,lentry2); Index: iSNSscn.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSscn.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSscn.c 8 Dec 2006 20:20:34 -0000 1.4 --- iSNSscn.c 13 Dec 2006 19:45:57 -0000 1.5 *************** *** 55,62 **** /* Global */ - extern int isns_db_debug; static int scn_xid = 1; - - extern int isns_scn_debug; extern int isns_scn_msg_filter; extern int isns_rsync_debug; --- 55,59 ---- *************** *** 198,202 **** if ( SUCCESS != ISNSSendMsg (p_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN)); p_node->scn_bitmap = 0; --- 195,199 ---- if ( SUCCESS != ISNSSendMsg (p_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN)); p_node->scn_bitmap = 0; *************** *** 260,264 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid Portal to send SCN)); return (ERROR); } --- 257,261 ---- else { ! DEBUG_0 (sns_scn_debug & 1, (No valid Portal to send SCN)); return (ERROR); } *************** *** 417,421 **** if ( SUCCESS != ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN, removing SCN)); /* Remove Node from SCN List */ --- 414,418 ---- if ( SUCCESS != ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN, removing SCN)); /* Remove Node from SCN List */ *************** *** 489,493 **** if ( SUCCESS != ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN, removing SCN)); /* Remove Node from SCN List */ --- 486,490 ---- if ( SUCCESS != ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN, removing SCN)); /* Remove Node from SCN List */ *************** *** 627,631 **** if ( SUCCESS!=ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN)); p_iscsi_node->scn_bitmap=0; --- 624,628 ---- if ( SUCCESS!=ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN)); p_iscsi_node->scn_bitmap=0; *************** *** 688,692 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid Portal to send SCN)); } --- 685,689 ---- else { ! DEBUG_0 (sns_scn_debug & 1, (No valid Portal to send SCN)); } *************** *** 736,740 **** if (0 == dd_key.id) { ! DEBUG_0(isns_db_debug & 1, (DD ID of zero is reserved)); return(ISNS_INVALID_REG_ERR); } --- 733,737 ---- if (0 == dd_key.id) { ! DEBUG_0(sns_scn_debug & 1, (DD ID of zero is reserved)); return(ISNS_INVALID_REG_ERR); } *************** *** 911,915 **** if (0 == dd_key.id) { ! DEBUG_0(isns_db_debug & 1, (DD ID of zero is reserved)); return(ISNS_INVALID_REG_ERR); } --- 908,912 ---- if (0 == dd_key.id) { ! DEBUG_0(sns_scn_debug & 1, (DD ID of zero is reserved)); return(ISNS_INVALID_REG_ERR); } *************** *** 1003,1007 **** if ( SUCCESS!=ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN)); p_iscsi_node->scn_bitmap=0; --- 1000,1004 ---- if ( SUCCESS!=ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN)); p_iscsi_node->scn_bitmap=0; *************** *** 1064,1068 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid Portal to send SCN)); } --- 1061,1065 ---- else { ! DEBUG_0 (sns_scn_debug & 1, (No valid Portal to send SCN)); } *************** *** 1219,1223 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid Portal to send SCN)); } --- 1216,1220 ---- else { ! DEBUG_0 (sns_scn_debug & 1, (No valid Portal to send SCN)); } *************** *** 1246,1250 **** if (key == NULL) { ! DEBUG_0 (isns_db_debug & 1, (SCN Rejected:No Key)); return (ISNS_SCN_EVENT_REJECTED_ERR); } --- 1243,1247 ---- if (key == NULL) { ! DEBUG_0 (sns_scn_debug & 1, (SCN Rejected:No Key)); return (ISNS_SCN_EVENT_REJECTED_ERR); } *************** *** 1253,1257 **** if (p_attr == NULL) { ! DEBUG_0 (isns_db_debug & 1, (SCN Rejected:No Op Attr)); return (ISNS_SCN_EVENT_REJECTED_ERR); } --- 1250,1254 ---- if (p_attr == NULL) { ! DEBUG_0 (sns_scn_debug & 1, (SCN Rejected:No Op Attr)); return (ISNS_SCN_EVENT_REJECTED_ERR); } *************** *** 1262,1266 **** if ( p_attr->tag != ISNS_ISCSI_SCN_BITMAP ) { ! DEBUG_1 (isns_db_debug & 1, (SCN Rejected:Wrong Op Attr %u), p_attr->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); --- 1259,1263 ---- if ( p_attr->tag != ISNS_ISCSI_SCN_BITMAP ) { ! DEBUG_1 (sns_scn_debug & 1, (SCN Rejected:Wrong Op Attr %u), p_attr->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); *************** *** 1275,1279 **** if (p_attr->tag != ISNS_IFCP_SCN_BITMAP) { ! DEBUG_1 (isns_db_debug & 1, (SCN Rejected:Wrong Op Attr %u), p_attr->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); --- 1272,1276 ---- if (p_attr->tag != ISNS_IFCP_SCN_BITMAP) { ! DEBUG_1 (sns_scn_debug & 1, (SCN Rejected:Wrong Op Attr %u), p_attr->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); *************** *** 1286,1290 **** default: ! DEBUG_1 (isns_db_debug & 1, (SCN Rejected:Invalid Key %u), key->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); --- 1283,1287 ---- default: ! DEBUG_1 (sns_scn_debug & 1, (SCN Rejected:Invalid Key %u), key->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); Index: iSNStrcv.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNStrcv.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNStrcv.c 1 Dec 2006 21:49:29 -0000 1.4 --- iSNStrcv.c 13 Dec 2006 19:45:57 -0000 1.5 *************** *** 31,34 **** --- 31,36 ---- ***********************************************************************/ + #include <signal.h> + #include <sys/poll.h> #include "iSNS.h" *************** *** 139,143 **** cb_p->sock=sockfd; #ifdef SNS_LINUX ! pthread_create (&ignore, NULL, (void*) TCP_RecvThread, (LPVOID)cb_p); #else CreateThread(0, 0, TCP_RecvThread, (LPVOID)cb_p, 0, &ignore); --- 141,145 ---- cb_p->sock=sockfd; #ifdef SNS_LINUX ! pthread_create (&ignore, NULL, (void*) TCP_RecvThread, (LPVOID)cb_p); #else CreateThread(0, 0, TCP_RecvThread, (LPVOID)cb_p, 0, &ignore); *************** *** 149,152 **** --- 151,156 ---- } + #define SOCKET_TIMEOUT_VALUE 120*1000 + /******************************************/ #ifdef SNS_LINUX *************** *** 165,168 **** --- 169,174 ---- int msg_size; int i; + struct pollfd ufds; + int rc; SNS_Msg_Hdr *p_msg; *************** *** 171,174 **** --- 177,183 ---- DEBUG_0(sns_tcp_debug & 1, (TCP_RecvThread: Starting)); sockfd=cb_p->sock; + + DEBUG_1(sns_tcp_debug & 1, (connection starting sockfd:%i), sockfd); + free(cb_p); startIndex=0; *************** *** 176,183 **** --- 185,205 ---- while (1) { + ufds.fd = sockfd; + ufds.events = POLLIN; + ufds.revents = 0; + rc = poll(&ufds, 1, SOCKET_TIMEOUT_VALUE); + if (rc == 0) + { + /* close connection if no activity */ + DEBUG_1(sns_tcp_debug &1, (connection timed out and closed:%i),sockfd); + close(sockfd); + break; + } + i = recv(sockfd, &buffer[endIndex], sizeof(buffer)-endIndex, 0); if (i<=0) { DEBUG_0(sns_tcp_debug & 1, (recv error or connection closed)); + close(sockfd); break; } |