File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -190,15 +190,21 @@ def getAddr(self):
190
190
def addPending (self , sender ):
191
191
try :
192
192
addr_info = socket .getaddrinfo (sender .host , None )
193
- if len (addr_info ) >= 2 :
194
- ip = addr_info [1 ][4 ][0 ]
195
- else :
196
- ip = addr_info [0 ][4 ][0 ]
193
+ ip = None
194
+ for entry in addr_info :
195
+ if len (entry [4 ]) == 2 :
196
+ ip = entry [4 ][0 ]
197
+ break
198
+
199
+ if not ip :
200
+ self .logger .info ('Unable to find IPv4 address in address info: ' + str (addr_info ))
201
+ return False
202
+
197
203
self .logger .info ("Adding %s - %s to the pending list" % (ip , sender ))
198
204
self .pending [ip ] = sender
199
205
return True
200
206
except Exception as e :
201
- self .bot .sendNotice (sender .nick , "Error while initialiasing DCC connection." )
207
+ self .bot .sendNotice (sender .nick , "Error while initializing DCC connection." )
202
208
print str (e )
203
209
return False
204
210
You can’t perform that action at this time.
0 commit comments