Skip to content
Snippets Groups Projects
Commit 531ed6f2 authored by Luigi Rizzo's avatar Luigi Rizzo
Browse files

add a bit of comment on what build_route does,

plus minor code simplification.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31895 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 88077a4d
No related branches found
No related tags found
Loading
...@@ -6622,7 +6622,11 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward ...@@ -6622,7 +6622,11 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward
p->route_persistant = backwards; p->route_persistant = backwards;
/* We build up head, then assign it to p->route when we're done */ /* Build a tailq, then assign it to p->route when done.
* If backwards, we add entries from the head so they end up
* in reverse order. However, we do need to maintain a correct
* tail pointer because the contact is always at the end.
*/
head = NULL; head = NULL;
tail = head; tail = head;
/* 1st we pass through all the hops in any Record-Route headers */ /* 1st we pass through all the hops in any Record-Route headers */
...@@ -6631,12 +6635,7 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward ...@@ -6631,12 +6635,7 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward
rr = __get_header(req, "Record-Route", &start); rr = __get_header(req, "Record-Route", &start);
if (*rr == '\0') if (*rr == '\0')
break; break;
for (;;) { for (; (rr = strchr(rr, '<')) ; rr += len) { /* Each route entry */
/* Each route entry */
/* Find < */
rr = strchr(rr, '<');
if (!rr)
break; /* No more hops */
++rr; ++rr;
len = strcspn(rr, ">") + 1; len = strcspn(rr, ">") + 1;
/* Make a struct route */ /* Make a struct route */
...@@ -6650,7 +6649,8 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward ...@@ -6650,7 +6649,8 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward
thishop->next = head; thishop->next = head;
head = thishop; head = thishop;
/* If this was the first then it'll be the tail */ /* If this was the first then it'll be the tail */
if (!tail) tail = thishop; if (!tail)
tail = thishop;
} else { } else {
thishop->next = NULL; thishop->next = NULL;
/* Link in at the end */ /* Link in at the end */
...@@ -6661,7 +6661,6 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward ...@@ -6661,7 +6661,6 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward
tail = thishop; tail = thishop;
} }
} }
rr += len;
} }
} }
   
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment