osc: don't use timer if delay=0 to (it messes with the execution order)
This commit is contained in:
parent
a8bbb02c67
commit
a6d824de1f
1 changed files with 12 additions and 6 deletions
|
|
@ -100,14 +100,20 @@ var oscOutFilter = function(data){
|
|||
}
|
||||
}
|
||||
|
||||
var oscInHandler = function(msg, timetag, info){
|
||||
var data = oscInFilter({address: msg.address, args: msg.args, host: info.address, port: info.port})
|
||||
receiveOsc(data)
|
||||
}
|
||||
|
||||
oscServer.on('message', function (msg, timetag, info) {
|
||||
var delay = timetag? Math.max(0,timetag.native - Date.now()) : 0,
|
||||
timer = delay ? setTimeout : setImmediate
|
||||
setTimeout(()=>{
|
||||
var data = oscInFilter({address: msg.address, args: msg.args, host: info.address, port: info.port})
|
||||
receiveOsc(data)
|
||||
}, delay)
|
||||
var delay = timetag? Math.max(0,timetag.native - Date.now()) : 0
|
||||
if (delay) {
|
||||
setTimeout(()=>{
|
||||
oscInHandler(msg, timetag, info)
|
||||
}, delay)
|
||||
} else {
|
||||
oscInHandler(msg, timetag, info)
|
||||
}
|
||||
})
|
||||
|
||||
oscServer.on('error', function (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue