Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9ef9c07

Browse files
committed
Changed to use make_call
1 parent b637221 commit 9ef9c07

1 file changed

Lines changed: 12 additions & 24 deletions

File tree

Demo/rpc/nfsclient.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -134,40 +134,28 @@ def mkcred(self):
134134
return self.cred
135135

136136
def Getattr(self, fh):
137-
self.start_call(1)
138-
self.packer.pack_fhandle(fh)
139-
self.do_call()
140-
as = self.unpacker.unpack_attrstat()
141-
self.end_call()
142-
return as
137+
return self.make_call(1, fh, \
138+
self.packer.pack_fhandle, \
139+
self.unpacker.unpack_attrstat)
143140

144141
def Setattr(self, sa):
145-
self.start_call(2)
146-
self.packer.pack_sattrargs(sa)
147-
self.do_call()
148-
as = self.unpacker.unpack_attrstat()
149-
self.end_call()
150-
return as
142+
return self.make_call(2, sa, \
143+
self.packer.pack_sattrargs, \
144+
self.unpacker.unpack_attrstat)
151145

152146
# Root() is obsolete
153147

154148
def Lookup(self, da):
155-
self.start_call(4)
156-
self.packer.pack_diropargs(da)
157-
self.do_call()
158-
dr = self.unpacker.unpack_diropres()
159-
self.end_call()
160-
return dr
149+
return self.make_call(4, da, \
150+
self.packer.pack_diropargs, \
151+
self.unpacker.unpack_diropres)
161152

162153
# ...
163154

164155
def Readdir(self, ra):
165-
self.start_call(16)
166-
self.packer.pack_readdirargs(ra)
167-
self.do_call()
168-
rr = self.unpacker.unpack_readdirres()
169-
self.end_call()
170-
return rr
156+
return self.make_call(16, ra, \
157+
self.packer.pack_readdirargs, \
158+
self.unpacker.unpack_readdirres)
171159

172160
# Shorthand to get the entire contents of a directory
173161
def Listdir(self, dir):

0 commit comments

Comments
 (0)