Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Bug 948912 - Mozmill fails to send large reports on OS X 10.6. r=hskupin
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmin-malutan authored and whimboo committed Jan 30, 2014
1 parent 80d34c9 commit b55ed4c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mozmill/mozmill/report.py
Expand Up @@ -13,6 +13,29 @@
from handlers import HandlerMatchException


# Due to an issue in urllib2 on mac we get EAGAIN (Errno 35) exception when
# sending bigger reports. Fix from:
# https://github.com/shazow/urllib3/issues/63#issuecomment-15447770
if mozinfo.isMac and '10.6' in mozinfo.version:
# Monkey patch socket.sendall to handle EAGAIN (Errno 35) on mac.
import errno
import socket
import time

def socket_sendall(self, data):
while len(data) > 0:
try:
bytes_sent = self.send(data)
data = data[bytes_sent:]
except socket.error, e:
if e.errno == errno.EAGAIN:
time.sleep(0.1)
else:
raise e

socket._socketobject.sendall = socket_sendall


class Report(object):
def __init__(self, report, date_format="%Y-%m-%dT%H:%M:%SZ"):
if not isinstance(report, basestring):
Expand Down

0 comments on commit b55ed4c

Please sign in to comment.