MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / do_lb_disable_dst

Function do_lb_disable_dst

modules/load_balancer/lb_data.c:1019–1047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1017
1018
1019int do_lb_disable_dst(struct sip_msg *req, struct lb_data *data, unsigned int verbose)
1020{
1021 struct usr_avp *id_avp;
1022 int_str id_val;
1023
1024 struct lb_dst *dst;
1025 int old_flags;
1026
1027 id_avp = search_first_avp( 0, id_avp_name, &id_val, NULL);
1028 if( id_avp && (is_avp_str_val(id_avp) == 0) ) {
1029 for( dst=data->dsts ; dst ; dst=dst->next ) {
1030 if( dst->id == id_val.n ) {
1031 old_flags = dst->flags;
1032 dst->flags |= LB_DST_STAT_DSBL_FLAG;
1033
1034 if( dst->flags != old_flags ) {
1035 lb_status_changed(dst);
1036 if( verbose )
1037 LM_INFO("manually disable destination %d <%.*s> "
1038 "from script\n",dst->id, dst->uri.len, dst->uri.s);
1039 }
1040 return 0;
1041 }
1042 }
1043 } else
1044 LM_DBG("no AVP ID -> nothing to disable\n");
1045
1046 return -1;
1047}
1048
1049
1050/* Checks, if the IP PORT is a LB destination

Callers 1

w_lb_disable_dstFunction · 0.85

Calls 2

search_first_avpFunction · 0.85
lb_status_changedFunction · 0.85

Tested by

no test coverage detected