Finish the PTS connection initialization code (and deinitialize, too).
authorEvan Broder <broder@mit.edu>
Sun, 21 Dec 2008 22:16:38 +0000 (16:16 -0600)
committerEvan Broder <broder@mit.edu>
Sun, 21 Dec 2008 22:16:59 +0000 (16:16 -0600)
Signed-off-by: Evan Broder <broder@mit.edu>

afs/_pts.pyx
afs/afs.pxd

index df7397c..65f0140 100644 (file)
@@ -67,7 +67,12 @@ cdef class PTS:
                                               sc,
                                               sec)
         
+        code = ubik_ClientInit(serverconns, &self.client)
+        if code != 0:
+            raise Exception("Failed to initialize ubik connection to Protection server: %s" % error_message(code))
+        
         code = rxs_Release(sc)
     
     def __dealloc__(self):
+        ubik_ClientDestroy(self.client)
         rx_Finalize()
index 06cf0d7..b4057c8 100644 (file)
@@ -52,14 +52,6 @@ cdef extern from "afs/cellconfig.h":
                             char *aservice,
                             afsconf_cell *acellInfo)
 
-cdef extern from "ubik.h":
-    enum:
-        MAXSERVERS
-    
-    # ubik_client is an opaque struct, so we don't care about its members
-    struct ubik_client:
-        pass
-
 cdef extern from "rx/rxkad.h":
     ctypedef char rxkad_level
     
@@ -123,5 +115,17 @@ cdef extern from "afs/prclient.h":
     enum:
         PRSRV
 
+cdef extern from "ubik.h":
+    enum:
+        MAXSERVERS
+    
+    # ubik_client is an opaque struct, so we don't care about its members
+    struct ubik_client:
+        pass
+    
+    int ubik_ClientInit(rx_connection **serverconns,
+                        ubik_client **aclient)
+    afs_int32 ubik_ClientDestroy(ubik_client *aclient)
+
 cdef extern from "afs/com_err.h":
     char * error_message(int)