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:
parent
0645fa11d4
commit
4d9e98f694
|
@ -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].
|
||||
|
|
Reference in New Issue