Example #1
0
def gevent_sendfile(out_fd, in_fd, offset, count):
    total_sent = 0
    while total_sent < count:
        try:
            _offset, sent = original_sendfile(out_fd, in_fd, offset + total_sent, count - total_sent)
            #print '%s: sent %s [%d%%]' % (out_fd, sent, 100*total_sent/count)
            total_sent += sent
        except OSError, ex:
            if ex[0] == EAGAIN:
                wait_write(out_fd)
            else:
                raise
Example #2
0
def gevent_sendfile(out_fd, in_fd, offset, count):
    total_sent = 0
    while total_sent < count:
        try:
            _offset, sent = original_sendfile(out_fd, in_fd,
                                              offset + total_sent,
                                              count - total_sent)
            #print '%s: sent %s [%d%%]' % (out_fd, sent, 100*total_sent/count)
            total_sent += sent
        except OSError, ex:
            if ex[0] == EAGAIN:
                wait_write(out_fd)
            else:
                raise
Example #3
0
def gevent_sendfile(out_fd, in_fd, offset, count):
    total_sent = 0
    sent = 0
    while total_sent < count:
        try:
            sent = original_sendfile(out_fd, in_fd, offset + total_sent,
                                     count - total_sent)
            total_sent += sent
        except OSError as ex:
            if ex.args[0] == EAGAIN:
                sent = 0
                # TODO: there is performance problem maybe
                wait_write(out_fd)
            else:
                raise
    return total_sent