@@ 466-480 (lines=15) @@ | ||
463 | else: |
|
464 | raise ValidationError("Invalid channel status.") |
|
465 | ||
466 | def reply_file_connection(self, in_message): |
|
467 | connection_id = in_message[VarNames.CONNECTION_ID] |
|
468 | sender_ws_id = self.sync_redis.shget(WEBRTC_CONNECTION, connection_id) |
|
469 | sender_ws_status = self.sync_redis.shget(connection_id, sender_ws_id) |
|
470 | self_ws_status = self.sync_redis.shget(connection_id, self.id) |
|
471 | if sender_ws_status == WebRtcRedisStates.READY and self_ws_status == WebRtcRedisStates.OFFERED: |
|
472 | self.async_redis_publisher.hset(connection_id, self.id, WebRtcRedisStates.RESPONDED) |
|
473 | self.publish(self.reply_webrtc( |
|
474 | Actions.REPLY_FILE_CONNECTION, |
|
475 | connection_id, |
|
476 | HandlerNames.WEBRTC_TRANSFER, |
|
477 | in_message[VarNames.CONTENT] |
|
478 | ), sender_ws_id) |
|
479 | else: |
|
480 | raise ValidationError("Invalid channel status.") |
|
481 | ||
482 | def reply_call_connection(self, in_message): |
|
483 | self.send_call_answer( |
|
@@ 564-575 (lines=12) @@ | ||
561 | continue |
|
562 | self.publish(message, ws_id) |
|
563 | ||
564 | def accept_file(self, in_message): |
|
565 | connection_id = in_message[VarNames.CONNECTION_ID] |
|
566 | content = in_message[VarNames.CONTENT] |
|
567 | sender_ws_id = self.sync_redis.shget(WEBRTC_CONNECTION, connection_id) |
|
568 | sender_ws_status = self.sync_redis.shget(connection_id, sender_ws_id) |
|
569 | self_ws_status = self.sync_redis.shget(connection_id, self.id) |
|
570 | if sender_ws_status == WebRtcRedisStates.READY \ |
|
571 | and self_ws_status in [WebRtcRedisStates.RESPONDED, WebRtcRedisStates.READY]: |
|
572 | self.async_redis_publisher.hset(connection_id, self.id, WebRtcRedisStates.READY) |
|
573 | self.publish(self.get_accept_file_message(connection_id, content), sender_ws_id) |
|
574 | else: |
|
575 | raise ValidationError("Invalid channel status") |
|
576 | ||
577 | # todo |
|
578 | # we can use channel_status = self.sync_redis.shgetall(connection_id) |