Skip to content

Commit 23302e9

Browse files
committed
snmpd: Remove agent_session_list
Nothing is ever added to this list. Since this list is always empty, remove it.
1 parent ca918f8 commit 23302e9

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

agent/snmp_agent.c

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ typedef struct _agent_nsap {
363363
} agent_nsap;
364364

365365
static agent_nsap *agent_nsap_list = NULL;
366-
static netsnmp_agent_session *agent_session_list = NULL;
367366
netsnmp_agent_session *netsnmp_processing_set = NULL;
368367
netsnmp_agent_session *agent_delegated_list = NULL;
369368
netsnmp_agent_session *netsnmp_agent_queued_list = NULL;
@@ -2129,38 +2128,16 @@ dump_sess_list(void)
21292128
netsnmp_agent_session *a;
21302129

21312130
DEBUGMSGTL(("snmp_agent", "DUMP agent_sess_list -> "));
2132-
for (a = agent_session_list; a != NULL; a = a->next) {
2133-
DEBUGMSG(("snmp_agent", "%8p[session %8p] -> ", a, a->session));
2134-
}
21352131
DEBUGMSG(("snmp_agent", "[NIL]\n"));
21362132
}
21372133
#endif /* NETSNMP_FEATURE_REMOVE_DUMP_SESS_LIST */
21382134

21392135
void
21402136
netsnmp_remove_and_free_agent_snmp_session(netsnmp_agent_session *asp)
21412137
{
2142-
netsnmp_agent_session *a, **prevNext = &agent_session_list;
2143-
21442138
DEBUGMSGTL(("snmp_agent", "REMOVE session == %8p\n", asp));
21452139

2146-
for (a = agent_session_list; a != NULL; a = *prevNext) {
2147-
if (a == asp) {
2148-
*prevNext = a->next;
2149-
a->next = NULL;
2150-
free_agent_snmp_session(a);
2151-
asp = NULL;
2152-
break;
2153-
} else {
2154-
prevNext = &(a->next);
2155-
}
2156-
}
2157-
2158-
if (a == NULL && asp != NULL) {
2159-
/*
2160-
* We couldn't find it on the list, so free it anyway.
2161-
*/
2162-
free_agent_snmp_session(asp);
2163-
}
2140+
free_agent_snmp_session(asp);
21642141
}
21652142

21662143
#ifndef NETSNMP_FEATURE_REMOVE_FREE_AGENT_SNMP_SESSION_BY_SESSION
@@ -2169,20 +2146,7 @@ netsnmp_free_agent_snmp_session_by_session(netsnmp_session * sess,
21692146
void (*free_request)
21702147
(netsnmp_request_list *))
21712148
{
2172-
netsnmp_agent_session *a, *next, **prevNext = &agent_session_list;
2173-
21742149
DEBUGMSGTL(("snmp_agent", "REMOVE session == %8p\n", sess));
2175-
2176-
for (a = agent_session_list; a != NULL; a = next) {
2177-
if (a->session == sess) {
2178-
*prevNext = a->next;
2179-
next = a->next;
2180-
free_agent_snmp_session(a);
2181-
} else {
2182-
prevNext = &(a->next);
2183-
next = a->next;
2184-
}
2185-
}
21862150
}
21872151
#endif /* NETSNMP_FEATURE_REMOVE_FREE_AGENT_SNMP_SESSION_BY_SESSION */
21882152

0 commit comments

Comments
 (0)