Code Duplication    Length = 12-15 lines in 2 locations

chat/tornado/message_handler.py 2 locations

@@ 361-375 (lines=15) @@
358
		self.pre_process_message.update({
359
			Actions.WEBRTC: self.proxy_webrtc,
360
			Actions.CLOSE_FILE_CONNECTION: self.close_file_connection,
361
			Actions.CLOSE_CALL_CONNECTION: self.close_call_connection,
362
			Actions.CANCEL_CALL_CONNECTION: self.cancel_call_connection,
363
			Actions.ACCEPT_CALL: self.accept_call,
364
			Actions.ACCEPT_FILE: self.accept_file,
365
			Actions.OFFER_FILE_CONNECTION: self.offer_webrtc_connection,
366
			Actions.OFFER_CALL_CONNECTION: self.offer_webrtc_connection,
367
			Actions.REPLY_FILE_CONNECTION: self.reply_file_connection,
368
			Actions.RETRY_FILE_CONNECTION: self.retry_file_connection,
369
			Actions.REPLY_CALL_CONNECTION: self.reply_call_connection,
370
		})
371
		self.post_process_message.update({
372
			Actions.OFFER_FILE_CONNECTION: self.set_opponent_call_channel,
373
			Actions.OFFER_CALL_CONNECTION: self.set_opponent_call_channel
374
		})
375
376
	def set_opponent_call_channel(self, message):
377
		connection_id = message[VarNames.CONNECTION_ID]
378
		if message[VarNames.WEBRTC_OPPONENT_ID] == self.id:
@@ 459-470 (lines=12) @@
456
		connection_id = in_message[VarNames.CONNECTION_ID]
457
		self_channel_status = self.sync_redis.shget(connection_id, self.id)
458
		if not self_channel_status:
459
			raise Exception("Access Denied")
460
		if self_channel_status != WebRtcRedisStates.CLOSED:
461
			sender_id = self.sync_redis.shget(WEBRTC_CONNECTION, connection_id)
462
			if sender_id == self.id:
463
				self.close_file_sender(connection_id)
464
			else:
465
				self.close_file_receiver(connection_id, in_message, sender_id)
466
			self.async_redis_publisher.hset(connection_id, self.id, WebRtcRedisStates.CLOSED)
467
468
	def close_call_connection(self, in_message):
469
		self.send_call_answer(
470
			in_message,
471
			WebRtcRedisStates.CLOSED,
472
			Actions.CLOSE_CALL_CONNECTION,
473
			[WebRtcRedisStates.READY, WebRtcRedisStates.RESPONDED],