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

callagent: Make it possible to stop/start the MGCPCallAgent

Remember the IP/Port, on start allocate the socket.
This commit is contained in:
Holger Hans Peter Freyther 2011-06-29 10:08:14 +02:00
parent 5eeef62086
commit a0dbcd42e2
1 changed files with 7 additions and 3 deletions

View File

@ -19,7 +19,7 @@
PackageLoader fileInPackage: 'Sockets'.
Object subclass: MGCPCallAgentBase [
| socket queue rx tx trunks sem |
| socket queue rx tx trunks sem addr port |
<category: 'MGCP-Callagent'>
<comment: 'I am responsible for the networking'>
@ -40,9 +40,10 @@ Object subclass: MGCPCallAgentBase [
initialize: anAddress port: aPort [
<category: 'creation'>
sem := Semaphore forMutualExclusion.
socket := Sockets.DatagramSocket local: anAddress port: aPort.
queue := SharedQueue new.
trunks := OrderedCollection new.
addr := anAddress.
port := aPort.
]
addTrunk: aTrunk [
@ -60,6 +61,9 @@ Object subclass: MGCPCallAgentBase [
start [
<category: 'handling'>
self stop.
socket := Sockets.DatagramSocket local: addr port: port.
"Receive datagrams from the socket..."
rx := [
[ | data |
@ -80,7 +84,7 @@ Object subclass: MGCPCallAgentBase [
]
stop [
socket close.
socket ifNotNil: [socket close].
tx ifNotNil: [tx terminate].
rx ifNotNil: [rx terminate].
]