Code Duplication    Length = 12-15 lines in 2 locations

chat/tornado/message_handler.py 2 locations

@@ 361-375 (lines=15) @@
358
			Actions.OFFER_FILE_CONNECTION: self.offer_webrtc_connection,
359
			Actions.OFFER_CALL_CONNECTION: self.offer_webrtc_connection,
360
			Actions.REPLY_FILE_CONNECTION: self.reply_file_connection,
361
			Actions.RETRY_FILE_CONNECTION: self.retry_file_connection,
362
			Actions.REPLY_CALL_CONNECTION: self.reply_call_connection,
363
		})
364
		self.post_process_message.update({
365
			Actions.OFFER_FILE_CONNECTION: self.set_opponent_call_channel,
366
			Actions.OFFER_CALL_CONNECTION: self.set_opponent_call_channel
367
		})
368
369
	def set_opponent_call_channel(self, message):
370
		connection_id = message[VarNames.CONNECTION_ID]
371
		if message[VarNames.WEBRTC_OPPONENT_ID] == self.id:
372
			return True
373
		self.sync_redis.hset(connection_id, self.id, WebRtcRedisStates.OFFERED)
374
375
	def offer_webrtc_connection(self, in_message):
376
		room_id = in_message[VarNames.CHANNEL]
377
		content = in_message.get(VarNames.CONTENT)
378
		qued_id = in_message[VarNames.WEBRTC_QUED_ID]
@@ 459-470 (lines=12) @@
456
				self.close_file_sender(connection_id)
457
			else:
458
				self.close_file_receiver(connection_id, in_message, sender_id)
459
			self.async_redis_publisher.hset(connection_id, self.id, WebRtcRedisStates.CLOSED)
460
461
	def close_call_connection(self, in_message):
462
		self.send_call_answer(
463
			in_message,
464
			WebRtcRedisStates.CLOSED,
465
			Actions.CLOSE_CALL_CONNECTION,
466
			[WebRtcRedisStates.READY, WebRtcRedisStates.RESPONDED],
467
			HandlerNames.PEER_CONNECTION
468
		)
469
470
	def cancel_call_connection(self, in_message):
471
		self.send_call_answer(
472
			in_message,
473
			WebRtcRedisStates.CLOSED,