if statement executing after condition failed (C- Multithreading) -
i encountered problem in project, , don't know have next (it's happening when load test , multi-threaded programming). problem related if inside else-if...
#define failure -1 #define success 1 #define error_getting -203 #define non_mms_dest_client 2 #define other_network_dest_client 6 int get_event_type(char *eventtype, char *domainname, char *dest, int sendertype) { int iret=0; int spin_retstatus=0; ret = get_client_interface_type (tbuff) ; log_msg (g_log_fp, log_debug, "ret [%d] get_client_interface_type",ret); if(ret == non_mms_dest_client) { /* not executing in current scenario */ } else if(ret == other_network_dest_client) { /* i'm getting return value 6 other_network_dest_client */ log_msg(g_log_fp,log_debug,"establishing connection"); spin_retstatus=contact_event_type_over_udp(tbuff,&domain,null,0); /* return values: success & failure */ if(failure == spin_retstatus) iret=error_getting; log_msg(g_log_fp,log_debug,"crash debug:: spin_retstatus: %d,iret= %d",spin_retstatus,iret); } ... /* i'm performing actions based on above return values */ } int contact_event_type_over_udp (char *cl_addr, char** domain_name, loc_info *location_info, int ati_req_type) { int call_ret =0; /* other variables */ if(cl_addr == null) { log_msg (g_log_fp, log_warning, "error: invalid msisdn.") ; call_ret = failure ; goto end_req_buff; } else { /* code @ end return success there no failure case in else loop*/ call_ret = success; goto end_req_buff; } end_req_buff: /* freeing pointer buffers */ return call_ret; }
here output (note: i'm getting output in times, remaining time i'm getting output expected based on code)
14-07-2015 07:31:41 [176028528] establishing connection 14-07-2015 07:31:41 [176028528] crash debug:: call_ret [1] mms.mtn.com.gh 14-07-2015 07:31:41 [176028528] crash debug:: spin_retstatus: 1, iret=-203
this copied log file , here 2nd statement return value of "contact_event_type_over_udp" function , i'm getting return value 1 (which success #define) i'm getting iret value -203.
i'm analysing possible situations didn't in case iret getting error_getting value (the number in [] thread process identify same thread or different thread , here i'm giving outputs based on same thread)
here other case getting values based on condition:
14-07-2015 07:37:17 [176028528] establishing connection 14-07-2015 07:37:17 [176028528] crash debug:: call_ret [1] mms.mtn.com.gh 14-07-2015 07:37:17 [176028528] crash debug:: spin_retstatus: 1, iret=0 14-07-2015 07:38:41 [176028528] crash debug:: call_ret [-1] 14-07-2015 07:38:41 [176028528] crash debug:: spin_retstatus: -1, iret=-203
somebody please me solve issue, if need more code i'll provide 'iret' variable never used places (whatever give code portion contains iret variable)
Comments
Post a Comment