swift/proxy/controllers/obj.py
def _send_file(self, write_timeout, exception_handler):
        """
        Method for a file PUT coroutine. Takes chunks from a queue and sends
        them down a socket.

        If something goes wrong, the "failed" attribute will be set to true
        and the exception handler will be called.
        """
        while True:
            chunk = self.queue.get()
            if not self.failed:
                if self.chunked:
                    to_send = "%x\r\n%s\r\n" % (len(chunk), chunk)
                else:
                    to_send = chunk
                try:
                    with ChunkWriteTimeout(write_timeout):
                        self.conn.send(to_send)
                except (Exception, ChunkWriteTimeout):
                    self.failed = True
                    exception_handler(self.node, _('Object'),
                                      _('Trying to write to %s') % self.path)
            # task_done()：每次从queue中get一个数据之后，当处理好相关问题，最后调用该方法，
            # 提示 join() 是否停止阻塞，让线程向前执行或者退出；
            self.queue.task_done()

        Method for a file PUT coroutine. Takes chunks from a queue and sends
        them down a socket.

        If something goes wrong, the "failed" attribute will be set to true
        and the exception handler will be called.
        
Method for a file PUT coroutine. Takes chunks from a queue and sends
them down a socket.

If something goes wrong, the "failed" attribute will be set to true
and the exception handler will be called.
Method for a file PUT coroutine . Takes chunks from a queue and sends them down a socket . If something goes wrong the " failed " attribute will be set to true and the exception handler will be called .
def _send_file(self, write_timeout, exception_handler):
        while True:
            chunk = self.queue.get()
            if not self.failed:
                if self.chunked:
                    to_send = "%x\r\n%s\r\n" % (len(chunk), chunk)
                else:
                    to_send = chunk
                try:
                    with ChunkWriteTimeout(write_timeout):
                        self.conn.send(to_send)
                except (Exception, ChunkWriteTimeout):
                    self.failed = True
                    exception_handler(self.node, _('Object'),
                                      _('Trying to write to %s') % self.path)
            self.queue.task_done()
def _send_file ( self , write_timeout , exception_handler ) : while True : chunk = self . queue . get ( ) if not self . failed : if self . chunked : to_send = "%x\r\n%s\r\n" % ( len ( chunk ) , chunk ) else : to_send = chunk try : with ChunkWriteTimeout ( write_timeout ) : self . conn . send ( to_send ) except ( Exception , ChunkWriteTimeout ) : self . failed = True exception_handler ( self . node , _ ( 'Object' ) , _ ( 'Trying to write to %s' ) % self . path ) self . queue . task_done ( )
Method for a file PUT coroutine.
Method for a file PUT coroutine .
"""
        Method for a file PUT coroutine. Takes chunks from a queue and sends
        them down a socket.

        If something goes wrong, the "failed" attribute will be set to true
        and the exception handler will be called.
        """ # task_done()：每次从queue中get一个数据之后，当处理好相关问题，最后调用该方法， # 提示 join() 是否停止阻塞，让线程向前执行或者退出；
self
write_timeout
exception_handler