use nonblocking sockets

master
mutantmonkey 2011-09-22 16:07:26 -04:00
parent 67ef6a0afe
commit 279e8ba969
2 changed files with 2 additions and 8 deletions

2
irc.py
View File

@ -101,7 +101,7 @@ class Bot(asynchat.async_chat):
if use_ssl:
sock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1)
# FIXME: ssl module does not appear to work properly with nonblocking sockets
#sock.setblocking(0)
sock.setblocking(0)
self.set_socket(sock)
def handle_connect(self):

View File

@ -9,7 +9,6 @@ http://inamidst.com/phenny/
import re, urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse, http.client, urllib.parse, time, http.cookiejar
from html.entities import name2codepoint
from string import join
import web
from tools import deprecated
@ -97,7 +96,7 @@ def noteuri(phenny, input):
noteuri.rule = r'.*(http[s]?://[^<> "\x01]+)[,.]?'
noteuri.priority = 'low'
titlecommands = r'(?:' + join(f_title.commands, r'|') + r')'
titlecommands = r'(?:' + r'|'.join(f_title.commands) + r')'
def snarfuri(phenny, input):
if re.match(r'(?i)' + phenny.config.prefix + titlecommands, input.group()):
return
@ -183,11 +182,6 @@ def gettitle(uri):
title = r_entity.sub(e, title)
if title:
try: title.decode('utf-8')
except:
try: title = title.decode('iso-8859-1')
except: title = title.decode('cp1252')
else: pass
title = title.replace('\n', '')
title = title.replace('\r', '')
else: title = None