From 6055daf2589e2009441f56794c894bb267b58d5c Mon Sep 17 00:00:00 2001
From: Supreet Deshpande <supreet.deshpande@espressif.com>
Date: Mon, 22 Oct 2018 11:55:09 +0530
Subject: [PATCH] bugfix/mdns_stack_config: Add configuration option for MDNS
 Stacksize

Added a Kconfig option to configure the MDNS task stack size.
---
 components/mdns/Kconfig                        | 9 +++++++++
 components/mdns/private_include/mdns_private.h | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/components/mdns/Kconfig b/components/mdns/Kconfig
index 3c55cd93..daea5377 100644
--- a/components/mdns/Kconfig
+++ b/components/mdns/Kconfig
@@ -17,5 +17,14 @@ config MDNS_MAX_SERVICES
         services to be open at the same time conserves memory. Specify
         the maximum amount of services here. The valid value is from 1
         to 64.
+
+config MDNS_STACKSIZE
+    int "Max stack size of MDNS"
+    range 2048 4096
+    default 4096
+    depends on ENABLE_MDNS
+    help
+        The stacksize of the MDNS task that will be responsible for transmitting
+        and receiving MDNS packets.
         
 endmenu
diff --git a/components/mdns/private_include/mdns_private.h b/components/mdns/private_include/mdns_private.h
index 568c81b0..939b9e89 100644
--- a/components/mdns/private_include/mdns_private.h
+++ b/components/mdns/private_include/mdns_private.h
@@ -52,7 +52,7 @@
 #define MDNS_ANSWER_SDPTR           0x80
 
 #define MDNS_SERVICE_PORT           5353                    // UDP port that the server runs on
-#define MDNS_SERVICE_STACK_DEPTH    4096                    // Stack size for the service thread
+#define MDNS_SERVICE_STACK_DEPTH    CONFIG_MDNS_STACKSIZE   // Stack size for the service thread
 #define MDNS_PACKET_QUEUE_LEN       16                      // Maximum packets that can be queued for parsing
 #define MDNS_ACTION_QUEUE_LEN       16                      // Maximum actions pending to the server
 #define MDNS_TXT_MAX_LEN            1024                    // Maximum string length of text data in TXT record