Just close the main session when shutting down under Windows,
not everything (so that it can still generate the shutdown trap).


git-svn-id: file:///home/hardaker/lib/sf-bkups/net-snmp-convert-svnrepo/trunk@6419 06827809-a52a-0410-b366-d66718629ded
diff --git a/agent/snmpd.c b/agent/snmpd.c
index 7b5f065..0f8b720 100644
--- a/agent/snmpd.c
+++ b/agent/snmpd.c
@@ -276,6 +276,7 @@
 	RETSIGTYPE
 SnmpdShutDown(int a)
 {
+        extern struct snmp_session main_session;
 	running = 0;
 #ifdef WIN32
 	/*
@@ -283,7 +284,7 @@
 	 * on signal. Thats why following function is called, which closes the 
 	 * socket descriptors and causes the select() to return
 	 */
-	snmp_close_sessions();
+	snmp_close(main_session);
 #endif
 }
 
@@ -722,13 +723,13 @@
     if (!ds_get_boolean(DS_APPLICATION_ID, DS_AGENT_QUIT_IMMEDIATELY))
         receive();
 #include "mib_module_shutdown.h"
-#ifdef WIN32
-    agent_status = AGENT_STOPPED;
-#endif
     DEBUGMSGTL(("snmpd/main", "sending shutdown trap\n"));
     SnmpTrapNodeDown();
     DEBUGMSGTL(("snmpd/main", "Bye...\n"));
     snmp_shutdown("snmpd");
+#ifdef WIN32
+    agent_status = AGENT_STOPPED;
+#endif
     return 0;
 }  /* End main() -- snmpd */