Skip to content

Commit

Permalink
don't hardcode the lists
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Jan 15, 2020
1 parent ed5a4bf commit b74a456
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions messaging/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# must be build with scons
from .messaging_pyx import Context, Poller, SubSocket, PubSocket # pylint: disable=no-name-in-module, import-error
from .messaging_pyx import MultiplePublishersError, MessagingError # pylint: disable=no-name-in-module, import-error
import capnp

assert MultiplePublishersError
assert MessagingError
Expand Down Expand Up @@ -147,12 +148,12 @@ def __init__(self, services, ignore_alive=None, addr="127.0.0.1"):
self.freq[s] = service_list[s].frequency

data = new_message()
if s in ['can', 'sensorEvents', 'liveTracks', 'sendCan',
'ethernetData', 'cellInfo', 'wifiScan',
'trafficEvents', 'orbObservation', 'carEvents']:
data.init(s, 0)
else:
try:
data.init(s)
except capnp.lib.capnp.KjException:
# lists
data.init(s, 0)

self.data[s] = getattr(data, s)
self.logMonoTime[s] = 0
self.valid[s] = data.valid
Expand Down

0 comments on commit b74a456

Please sign in to comment.