smalltalk
/
osmo-st-mgcp
Archived
1
0
Fork 0

callagent: Keep the MGCPParser around

The parser is using becomeForward: which can be an expensive
operation and by keeping the parser around we should avoid this.
This commit is contained in:
Holger Hans Peter Freyther 2011-06-24 21:04:54 +02:00
parent 0645fa11d4
commit 4d9e98f694
1 changed files with 7 additions and 2 deletions

View File

@ -91,7 +91,7 @@ Object subclass: MGCPCallAgentBase [
]
MGCPCallAgentBase subclass: MGCPCallAgent [
| transactions |
| transactions parser |
<category: 'MGCP-Callagent'>
<comment: 'I deal with transactions and timeouts'>
@ -139,11 +139,16 @@ MGCPCallAgentBase subclass: MGCPCallAgent [
^ ran.
]
parser [
<category: 'private'>
^ parser ifNil: [parser := MGCPParser new]
]
handleData: aData [
[
| res data id trans |
data := aData data copyFrom: 1 to: aData size.
res := MGCPParser new parse: data asString.
res := self parser parse: data asString.
id := res transactionId asInteger.
trans := sem critical: [transactions copy].