add: if (parse_uri(rt->nameaddr.uri.s, rt->nameaddr.uri.len, &puri) < 0) { LOG(L_ERR, "after_loose: Error while parsing the " "double route URI\n"); return RR_ERROR; } si = grep_sock_info( &puri.host, puri.port_no, puri.proto); if (si) { _m->force_send_socket = si; } else { LOG(L_WARN,"WARNING:rr:after_loose: no socket found for " "match second RR\n"); }
context: static inline int after_loose(struct sip_msg* _m, int preloaded){	struct hdr_field* hdr;	struct sip_uri puri;	rr_t* rt;	int res;	#ifdef ENABLE_USER_CHECK	int ret;#endif	str* uri;	hdr = _m->route;	rt = (rr_t*)hdr->parsed;	uri = &rt->nameaddr.uri;	if (parse_uri(uri->s, uri->len, &puri) < 0) {		LOG(L_ERR, "after_loose: Error while parsing the first route URI\n");		return RR_ERROR;	}	/* IF the URI was added by me, remove it */#ifdef ENABLE_USER_CHECK	ret=is_myself(&puri.user, &puri.host, puri.port_no);	if (ret>0)#else	if (is_myself(&puri.host, puri.port_no))#endif	{		DBG("after_loose: Topmost route URI: '%.*s' is me\n",			uri->len, ZSW(uri->s));		/* set the hooks for the params -bogdan */		routed_msg_id = _m->id;		routed_params = puri.params;		/* run RR callbacks -bogdan */		run_rr_callbacks( _m, &routed_params );		if (!rt->next) {			/* No next route in the same header, remove the whole header			 * field immediately			 */			if (!del_lump(_m, hdr->name.s - _m->buf, hdr->len, 0)) {				LOG(L_ERR, "after_loose: Can't remove Route HF\n");				return RR_ERROR;			}			res = find_next_route(_m, &hdr);			if (res < 0) {				LOG(L_ERR, "after_loose: Error while finding next route\n");				return RR_ERROR;			}			if (res > 0) { /* No next route found */				DBG("after_loose: No next URI found\n");				return (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);			}			rt = (rr_t*)hdr->parsed;		} else rt = rt->next;				if (enable_double_rr && is_2rr(&puri.params)) {			if (!rt->next) {				/* No next route in the same header, remove the whole header				 * field immediately */				if (!del_lump(_m, hdr->name.s - _m->buf, hdr->len, 0)) {					LOG(L_ERR, "after_loose: Can't remove Route HF\n");					return RR_ERROR;				}				res = find_next_route(_m, &hdr);				if (res < 0) {					LOG(L_ERR,"after_loose: Error while finding next route\n");					return RR_ERROR;				}				if (res > 0) { /* No next route found */					DBG("after_loose: No next URI found\n");					return (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);				}				rt = (rr_t*)hdr->parsed;			} else rt = rt->next;		}				uri = &rt->nameaddr.uri;		if (parse_uri(uri->s, uri->len, &puri) < 0) {			LOG(L_ERR, "after_loose: Error while parsing the first route URI\n");			return RR_ERROR;		}	} else {#ifdef ENABLE_USER_CHECK		/* check if it the ignored user */		if(ret < 0)			return NOT_RR_DRIVEN;#endif		DBG("after_loose: Topmost URI is NOT myself\n");	}	DBG("after_loose: URI to be processed: '%.*s'\n", uri->len, ZSW(uri->s));	if (is_strict(&puri.params)) {		DBG("after_loose: Next URI is a strict router\n");		if (handle_sr(_m, hdr, rt) < 0) {			LOG(L_ERR, "after_loose: Error while handling strict router\n");			return RR_ERROR;		}	} else {		/* Next hop is loose router */		DBG("after_loose: Next URI is a loose router\n");		if (set_dst_uri(_m, uri) < 0) {			LOG(L_ERR, "after_loose: Error while setting dst_uri\n");			return RR_ERROR;		}		/* There is a previous route uri which was 2nd uri of mine		 * and must be removed here */		if (rt != hdr->parsed) {			if (!del_lump(_m, hdr->body.s - _m->buf, 			rt->nameaddr.name.s - hdr->body.s, 0)) {				LOG(L_ERR, "after_loose: Can't remove Route HF\n");				return RR_ERROR;			}					}	}	return RR_DRIVEN;}