'Processes an SSYNC request.
Acquires a semaphore lock and then proceeds through the steps
of the SSYNC process.'

def __call__(self):

    try:
        try:
            (yield '\r\n')
            if self.app.replication_semaphore:
                if (not self.app.replication_semaphore.acquire(False)):
                    raise swob.HTTPServiceUnavailable()
            try:
                with self.diskfile_mgr.replication_lock(self.device):
                    for data in self.missing_check():
                        (yield data)
                    for data in self.updates():
                        (yield data)
                self.disconnect = False
            finally:
                if self.app.replication_semaphore:
                    self.app.replication_semaphore.release()
        except exceptions.ReplicationLockTimeout as err:
            self.app.logger.debug(('%s/%s/%s    SSYNC    LOCK    TIMEOUT:    %s' % (self.request.remote_addr, self.device, self.partition, err)))
            (yield (':ERROR:    %d    %r\n' % (0, str(err))))
        except exceptions.MessageTimeout as err:
            self.app.logger.error(('%s/%s/%s    TIMEOUT    in    ssync.Receiver:    %s' % (self.request.remote_addr, self.device, self.partition, err)))
            (yield (':ERROR:    %d    %r\n' % (408, str(err))))
        except swob.HTTPException as err:
            body = ''.join(err({}, (lambda *args: None)))
            (yield (':ERROR:    %d    %r\n' % (err.status_int, body)))
        except Exception as err:
            self.app.logger.exception(('%s/%s/%s    EXCEPTION    in    ssync.Receiver' % (self.request.remote_addr, self.device, self.partition)))
            (yield (':ERROR:    %d    %r\n' % (0, str(err))))
    except Exception:
        self.app.logger.exception('EXCEPTION    in    ssync.Receiver')
    if self.disconnect:
        try:
            socket = self.request.environ['wsgi.input'].get_socket()
            eventlet.greenio.shutdown_safe(socket)
            socket.close()
        except Exception:
            pass
