Skip to content

Commit

Permalink
Fix issue #54 - Make optional Mod-host feedback socket
Browse files Browse the repository at this point in the history
  • Loading branch information
SrMouraSilva committed Sep 17, 2017
1 parent cfc28e9 commit 617f421
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ Version 0.5.1 -- released 06//17
- `Issue #53`_ - :class:`Autosaver` - Remove effect with connections breaks.
Disable connections removed notification when a effect with connections has removed;
- :class:`Autosaver` - Add :attr:`.Observable.real_list` attribute for access the list of :class:`ObservableList`.
- `Issue #54`_ - :class:`Mod-host` - Fix `feedback_socket optional`_ problem

.. _Issue #52: https://github.com/PedalPi/PluginsManager/issues/52
.. _Issue #53: https://github.com/PedalPi/PluginsManager/issues/53
.. _Issue #54: https://github.com/PedalPi/PluginsManager/issues/54
.. _default feedback_socket disabled: https://github.com/moddevices/mod-host/commit/31b1d04deb91c88420e1e0dd0cc4fad523f55712

Version 0.5.0 -- released 05/29/17
**********************************
Expand Down
17 changes: 14 additions & 3 deletions pluginsmanager/observer/mod_host/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

from pluginsmanager.observer.mod_host.connection import Connection
from pluginsmanager.observer.mod_host.protocol_parser import ProtocolParser

Expand All @@ -22,6 +24,9 @@ class Host:
"""

def __init__(self, address='localhost', port=5555):
self.connection = None
self.connection_fd = None

# mod-host works if only exists two connections:
# - For communication
try:
Expand All @@ -30,7 +35,11 @@ def __init__(self, address='localhost', port=5555):
raise ConnectionRefusedError(str(e) + '. Do you starts mod-host?') from e

# - For callback?
self.connection_fd = Connection(port+1, address)
try:
self.connection_fd = Connection(port+1, address)
except ConnectionRefusedError as e:
logging.info('Mod-host - Feedback socket is not enabled')
logging.info(' Try start Mod-host using: mod-host -f {}'.format(port+1))

self.instance_index = 0

Expand Down Expand Up @@ -97,5 +106,7 @@ def close(self):
"""
Quit the connection with mod-host
"""
self.connection.close()
self.connection_fd.close()
if self.connection is not None:
self.connection.close()
if self.connection_fd is not None:
self.connection_fd.close()

0 comments on commit 617f421

Please sign in to comment.