Hi!
May I ask who had the glorious idea to completely screw up the SocketMMI.py implementation ?
The C++ part still allows multiple connections to the /tmp/mmi.socket, but the python part of the OpenPLi image now has hardcoded that only a single socker 0 is allowed ?
def setSession(self, session):
self.session = session
def connected(self):
return socketmmi.getState(0)
def getName(self):
return socketmmi.getName(0)
def startMMI(self):
slot = 0 <<<<<<< ????????????
self.dlgs[slot] = self.session.openWithCallback(self.dlgClosed, ....
In an original DMM image this looks like this (slot is always passed as an argument as it should be):
def numConnections(self):
return self.socket_ui.numConnections()
def getState(self, slot):
return self.socket_ui.getState(slot)
def getName(self, slot):
return self.socket_ui.getName(slot)
def startMMI(self, slot):
self.dlgs[slot] = self.session.openWithCallback(self.dlgClosed ....
Same in plugin.py, only single connection is allowed:
def main(session, **kwargs):
socketHandler.startMMI()
def menu(menuid, **kwargs):
if menuid == "setup" and socketHandler and socketHandler.connected():
return [(socketHandler.getName(), main, "socket_mmi", 0)]
return [ ]
Compare:
def menuCallback(slot, session, **kwargs):
socketHandler.startMMI(slot)
def menu(menuid, **kwargs):
ret = [ ]
if menuid == "setup" and socketHandler:
connections = socketHandler.numConnections()
slot = 0;
valid = 0;
while valid < connections and slot < 256:
if socketHandler.getState(slot):
ret.append((socketHandler.getName(slot), boundFunction(menuCallback, slot), .....................
valid += 1
slot += 1
return ret
This causes second connection to the mmi.socket to never get connected:
netstat -alx | grep mmi
unix 2 [ ACC ] STREAM LISTENING 13540 /tmp/mmi.socket
unix 3 [ ] STREAM CONNECTING 0 /tmp/mmi.socket
unix 3 [ ] STREAM CONNECTED 13555 /tmp/mmi.socket
Can somebody please explain what the (good) intention was in this case and if there is a fair chance to revert it to allow multiple MMI connections again ?
Ciao
gutemine
Edited by gutemine, 4 September 2016 - 10:45.