Skip to content

Commit 1edd54c

Browse files
author
Minggang Wang
committed
Synchronize the handles when added
When adding new handles of timer/subscription/client/service, they should be synchronized to the native side, which will be used in the rcl to query the events.
1 parent ecdc10c commit 1edd54c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/node.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ class Node {
134134
let timer = new Timer(timerHandle, period, callback);
135135
debug('Finish creating timer, period = %d.', period);
136136
this._timers.push(timer);
137+
this.syncHandles();
138+
137139
return timer;
138140
}
139141

@@ -196,6 +198,8 @@ class Node {
196198
let subscription = Subscription.createSubscription(this.handle, typeClass, topic, callback, qos);
197199
debug('Finish creating subscription, topic = %s.', topic);
198200
this._subscriptions.push(subscription);
201+
this.syncHandles();
202+
199203
return subscription;
200204
}
201205

@@ -221,6 +225,8 @@ class Node {
221225
let client = Client.createClient(this.handle, serviceName, typeClass, qos);
222226
debug('Finish creating client, service = %s.', serviceName);
223227
this._clients.push(client);
228+
this.syncHandles();
229+
224230
return client;
225231
}
226232

@@ -262,6 +268,8 @@ class Node {
262268
let service = Service.createService(this.handle, serviceName, typeClass, callback, qos);
263269
debug('Finish creating service, service = %s.', serviceName);
264270
this._services.push(service);
271+
this.syncHandles();
272+
265273
return service;
266274
}
267275

0 commit comments

Comments
 (0)