Summary: | ASTERISK-05986: [patch][post 1.4] parking extension selection | ||
Reporter: | Luigi Rizzo (rizzo) | Labels: | |
Date Opened: | 2006-01-05 10:50:39.000-0600 | Date Closed: | 2011-06-07 14:10:34 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Resources/res_features |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) parkinglot.diff | |
Description: | the code for selecting the parking extension in res_features.c::ast_park_call() is extremely expensive because it has O(N*M) cost, where N is the size of the parking lot, and M is the number of parked calls. This patch uses a different, documented algorithm which does a single pass on the parkinglot list (so it is O(M)) to find the extension to use and the insertion point. On passing, in the same function, remove some unnecessary parentheses according to coding guidelines, localize a variable, and replace some if/then/else constructs with equivalent conditional assignments. | ||
Comments: | By: Matt O'Gorman (mogorman) 2006-01-18 15:00:13.000-0600 rizzo when i tried this on my box in the lab Jan 18 15:56:00 WARNING[7899]: res_features.c:307 ast_park_call: No more parking spaces it told me i was out of room !!! i have it setup for 20 spaces starting at 701. does this work on your end? By: Luigi Rizzo (rizzo) 2006-01-18 15:14:03.000-0600 yes, forgot two lines to cover the case of an empty parking lot :) see below, should fix things (just tested here) i = parking_start; /* a candidate */ ast_mutex_lock(&parking_lock); + if (parkinglot == NULL) /* we will not enter the loop */ + x = parking_next; /* so force the best candidate */ for (prev = NULL, cur = parkinglot; cur; i++, prev = cur, cur = cur->next) { if (cur->parkingnum == i) /* candidate is in use, try next */ By: Olle Johansson (oej) 2006-03-08 02:59:03.000-0600 Any new patch or does this exist in your branch? Would it be possible to get the same patch for the multiparking code (test-this-branch or multiparking branch) ? By: Serge Vecher (serge-v) 2006-05-04 09:28:18 By: Matt O'Gorman (mogorman) 2006-05-23 12:37:07 hey rizzo , patch is no longer any good i was wondering if you wanted to fix that bug and update the patch. thanks mog By: Serge Vecher (serge-v) 2006-06-07 16:02:37 *ping* By: Serge Vecher (serge-v) 2006-06-30 13:39:13 marking post 1.4 as per rizzo. By: jmls (jmls) 2006-10-31 12:55:04.000-0600 rizzo, any update on this ? By: jmls (jmls) 2007-01-07 03:06:52.000-0600 rizzo, any update on this ? By: Olle Johansson (oej) 2007-05-15 15:26:31 This code was submitted January 2006. Can someone take a look and either close or commit this code? Thanks. By: Jason Parker (jparker) 2007-09-04 17:10:49 Closing, as this is very severely out of date. |