Mercurial > hg > freeDiameter
comparison extensions/app_radgw/rgw_clients.c @ 548:345537783a90
Allow duplicate messages to be processed after Diameter answer has been received.
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Wed, 15 Sep 2010 10:41:43 +0900 |
parents | 77b575250103 |
children | 4c935aecee6c |
comparison
equal
deleted
inserted
replaced
547:77b575250103 | 548:345537783a90 |
---|---|
1050 | 1050 |
1051 /* Finished */ | 1051 /* Finished */ |
1052 return 0; | 1052 return 0; |
1053 } | 1053 } |
1054 | 1054 |
1055 /* Call this function when a RADIUS request has explicitely no answer (mainly accounting) so | |
1056 that we purge the duplicate cache and allow further message to be translated again. | |
1057 This is useful for example when a temporary error occurred in Diameter (like UNABLE_TO_DELIVER) */ | |
1058 int rgw_client_finish_nosend(struct rgw_radius_msg_meta * req, struct rgw_client * cli) | |
1059 { | |
1060 int p; | |
1061 struct fd_list * li; | |
1062 | |
1063 TRACE_ENTRY("%p %p", req, cli); | |
1064 CHECK_PARAMS( req && cli ); | |
1065 | |
1066 /* update the duplicate cache */ | |
1067 if (req->serv_type == RGW_PLG_TYPE_AUTH) | |
1068 p = 0; | |
1069 else | |
1070 p = 1; | |
1071 | |
1072 CHECK_POSIX( pthread_mutex_lock( &cli->dupl_info[p].dupl_lock ) ); | |
1073 | |
1074 /* Search this message in our list */ | |
1075 for (li = cli->dupl_info[p].dupl_by_id.next; li != &cli->dupl_info[p].dupl_by_id; li = li->next) { | |
1076 int cmp = 0; | |
1077 struct req_info * r = (struct req_info *)(li->o); | |
1078 if (r->id < req->radius.hdr->identifier) | |
1079 continue; | |
1080 if (r->id > req->radius.hdr->identifier) | |
1081 break; | |
1082 if (r->port < req->port) | |
1083 continue; | |
1084 if (r->port > req->port) | |
1085 break; | |
1086 cmp = memcmp(&r->auth[0], &req->radius.hdr->authenticator[0], 16); | |
1087 if (cmp < 0) | |
1088 continue; | |
1089 if (cmp > 0) | |
1090 break; | |
1091 | |
1092 /* We have the request in our duplicate cache, remove it */ | |
1093 fd_list_unlink(&r->by_id); | |
1094 fd_list_unlink(&r->by_time); | |
1095 dupl_free_req_info(r); | |
1096 break; | |
1097 } | |
1098 | |
1099 CHECK_POSIX( pthread_mutex_unlock( &cli->dupl_info[p].dupl_lock ) ); | |
1100 | |
1101 /* Finished */ | |
1102 return 0; | |
1103 } | |
1104 |