Public » MiniRedis Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

do not crash if the client socket is closed

Changeset b6b1dac2595d

Parent dfd71e803656

by Profile picture of Benjamin PollackBenjamin Pollack

Changes to one file · Browse files at b6b1dac2595d Showing diff from parent dfd71e803656 Diff from another changeset...

Change 1 of 1 Show Entire File miniredis.py Stacked
 
87
88
89
90
 
 
 
 
91
92
93
 
87
88
89
 
90
91
92
93
94
95
96
@@ -87,7 +87,10 @@
    def log(self, client, s):   if self.log_file: - who = '%s:%s' % client.socket.getpeername() if client else 'SERVER' + try: + who = '%s:%s' % client.socket.getpeername() if client else 'SERVER' + except: + who = '<CLOSED>'   self.log_file.write('%s - %s: %s\n' % (datetime.datetime.now(), who, s))   self.log_file.flush()