Code Duplication    Length = 12-15 lines in 2 locations

chat/tornado/message_handler.py 2 locations

@@ 361-375 (lines=15) @@
358
			Actions.OFFER_CALL_CONNECTION: self.set_opponent_call_channel
359
		})
360
361
	def set_opponent_call_channel(self, message):
362
		connection_id = message[VarNames.CONNECTION_ID]
363
		if message[VarNames.WEBRTC_OPPONENT_ID] == self.id:
364
			return True
365
		self.sync_redis.hset(connection_id, self.id, WebRtcRedisStates.OFFERED)
366
367
	def offer_webrtc_connection(self, in_message):
368
		room_id = in_message[VarNames.CHANNEL]
369
		content = in_message.get(VarNames.CONTENT)
370
		qued_id = in_message[VarNames.WEBRTC_QUED_ID]
371
		connection_id = id_generator(RedisPrefix.CONNECTION_ID_LENGTH)
372
		# use list because sets dont have 1st element which is offerer
373
		self.async_redis_publisher.hset(WEBRTC_CONNECTION, connection_id, self.id)
374
		self.async_redis_publisher.hset(connection_id, self.id, WebRtcRedisStates.READY)
375
		opponents_message = self.offer_webrtc(content, connection_id, room_id, in_message[VarNames.EVENT])
376
		self_message = self.set_connection_id(qued_id, connection_id)
377
		self.ws_write(self_message)
378
		self.logger.info('!! Offering a webrtc, connection_id %s', connection_id)
@@ 459-470 (lines=12) @@
456
			WebRtcRedisStates.CLOSED,
457
			Actions.CLOSE_CALL_CONNECTION,
458
			[WebRtcRedisStates.READY, WebRtcRedisStates.RESPONDED],
459
			HandlerNames.PEER_CONNECTION
460
		)
461
462
	def cancel_call_connection(self, in_message):
463
		self.send_call_answer(
464
			in_message,
465
			WebRtcRedisStates.CLOSED,
466
			Actions.CANCEL_CALL_CONNECTION,
467
			[WebRtcRedisStates.OFFERED],
468
			HandlerNames.WEBRTC_TRANSFER
469
		)
470
471
	def close_file_receiver(self, connection_id, in_message, sender_id):
472
		sender_status = self.sync_redis.shget(connection_id, sender_id)
473
		if not sender_status: