diff options
author | Mattias Andrée <maandree@kth.se> | 2016-08-17 09:05:14 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-08-17 09:05:14 +0200 |
commit | 897c90621a7cb85545864df9fd56c607dcef5585 (patch) | |
tree | 1278c7a4e4a236137945f40875f2ac8d438a8ac2 /src/libcoopgamma.py | |
parent | NUL-termination (diff) | |
download | pylibcoopgamma-897c90621a7cb85545864df9fd56c607dcef5585.tar.gz pylibcoopgamma-897c90621a7cb85545864df9fd56c607dcef5585.tar.bz2 pylibcoopgamma-897c90621a7cb85545864df9fd56c607dcef5585.tar.xz |
fixs
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/libcoopgamma.py')
-rw-r--r-- | src/libcoopgamma.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libcoopgamma.py b/src/libcoopgamma.py index c75ed04..ee0ec63 100644 --- a/src/libcoopgamma.py +++ b/src/libcoopgamma.py @@ -720,7 +720,7 @@ class Context: params = (self.fd, data) return 'libcoopgamma.Context(%s)' % ', '.join(repr(p) for p in params) - def connect(self, method, site): + def connect(self, method = None, site = None): ''' Connect to a coopgamma server, and start it if necessary @@ -736,12 +736,13 @@ class Context: ''' if method is not None and isinstance(method, int): method = str(method) - error = llibcoopgamma_native.ibcoopgamma_native_connect(method, site, self.address) - if error is not None: - if error == 0: + (successful, value) = libcoopgamma_native.libcoopgamma_native_connect(method, site, self.address) + if not successful: + if value == 0: raise ServerInitialisationError() else: - raise ErrorReport.create_error(error) + raise ErrorReport.create_error(value) + self.fd = value def detach(self): ''' |