Skip to content

Commit

Permalink
fixing issue 58 on google code
Browse files Browse the repository at this point in the history
  • Loading branch information
bashwork committed Mar 22, 2012
1 parent 7843378 commit e343a98
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ I get time doing such tasks as:
License Information
------------------------------------------------------------

Pymodbus is built on top of code developed from by:
Pymodbus is built on top of code developed from/by:
* Copyright (c) 2001-2005 S.W.A.C. GmbH, Germany.
* Copyright (c) 2001-2005 S.W.A.C. Bohemia s.r.o., Czech Republic.
* Hynek Petrak <[email protected]>
Expand Down
7 changes: 6 additions & 1 deletion pymodbus/client/async.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def process():
from pymodbus.exceptions import ConnectionException
from pymodbus.transaction import ModbusSocketFramer, ModbusTransactionManager
from pymodbus.client.common import ModbusClientMixin
from twisted.python.failure import Failure

#---------------------------------------------------------------------------#
# Logging
Expand Down Expand Up @@ -82,6 +83,9 @@ def connectionLost(self, reason):
'''
_logger.debug("Client disconnected from modbus server: %s" % reason)
self._connected = False
while self._requests:
self._requests.popleft().errback(Failure(
ConnectionException('Connection lost during request')))

def dataReceived(self, data):
''' Get response, check for valid message, decode result
Expand Down Expand Up @@ -111,7 +115,8 @@ def _buildResponse(self):
:returns: A defer linked to the latest request
'''
if not self._connected:
return defer.fail(ConnectionException('Client is not connected'))
return defer.fail(Failure(
ConnectionException('Client is not connected')))

d = defer.Deferred()
self._requests.append(d)
Expand Down
6 changes: 6 additions & 0 deletions pymodbus/client/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
'''
Modbus Client Common
----------------------------------
This is a common client mixin that can be used by
both the synchronous and asynchronous clients to
simplify the interface.
'''
from pymodbus.bit_read_message import *
from pymodbus.bit_write_message import *
Expand Down

0 comments on commit e343a98

Please sign in to comment.