##// END OF EJS Templates
patch: use set instead of dict
patch: use set instead of dict

File last commit:

r8386:4aad9821 default
r8461:88f317e7 default
Show More
common.py
29 lines | 754 B | text/x-python | PythonLexer
Bryan O'Sullivan
Add inotify extension
r6239 # server.py - inotify common protocol code
#
# Copyright 2006, 2007, 2008 Bryan O'Sullivan <bos@serpentine.com>
# Copyright 2007, 2008 Brendan Cully <brendan@kublai.com>
#
Martin Geisler
updated license to be explicit about GPL version 2
r8225 # This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
Bryan O'Sullivan
Add inotify extension
r6239
import cStringIO, socket, struct
version = 1
Nicolas Dumazet
inotify: Abstract the layer format and sizes to a inotify.common dictionary...
r8386 resphdrfmts = {
'STAT': '>llllllll' # status requests
}
resphdrsizes = dict((k, struct.calcsize(v))
for k, v in resphdrfmts.iteritems())
Bryan O'Sullivan
Add inotify extension
r6239
def recvcs(sock):
cs = cStringIO.StringIO()
s = True
try:
while s:
s = sock.recv(65536)
cs.write(s)
finally:
sock.shutdown(socket.SHUT_RD)
cs.seek(0)
return cs