Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r992 committed - Add tcp_stat_init_agent and tcp_stats_free_agent

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r992 committed - Add tcp_stat_init_agent and tcp_stats_free_agent


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r992 committed - Add tcp_stat_init_agent and tcp_stats_free_agent
  • Date: Mon, 10 Mar 2014 13:43:35 +0000

Revision: 992
Author:

Date: Mon Mar 10 13:41:40 2014 UTC
Log: Add tcp_stat_init_agent and tcp_stats_free_agent


http://code.google.com/p/ndt/source/detail?r=992

Modified:
/branches/aaron-tcp_stats_cleanup/src/web100-util.c
/branches/aaron-tcp_stats_cleanup/src/web100srv.c
/branches/aaron-tcp_stats_cleanup/src/web100srv.h

=======================================
--- /branches/aaron-tcp_stats_cleanup/src/web100-util.c Mon Mar 10 13:41:09 2014 UTC
+++ /branches/aaron-tcp_stats_cleanup/src/web100-util.c Mon Mar 10 13:41:40 2014 UTC
@@ -1063,3 +1063,31 @@
#endif
}

+tcp_stat_agent *tcp_stats_init_agent() {
+ tcp_stat_agent *agent;
+
+#if USE_WEB100
+ if ((agent = web100_attach(WEB100_AGENT_TYPE_LOCAL,
+ NULL)) == NULL) {
+ web100_perror("web100_attach");
+ return NULL;
+ }
+#elif USE_WEB10G
+ if (estats_nl_client_init(&agent) != NULL) {
+ log_println(0,
+ "Error: estats_client_init failed."
+ "Unable to use web10g.");
+ return NULL;
+ }
+#endif
+ return agent;
+}
+
+void tcp_stats_free_agent(tcp_stat_agent *agent) {
+#if USE_WEB100
+ web100_detach(agent);
+#elif USE_WEB10G
+ estats_nl_client_destroy(&agent);
+#endif
+ return;
+}
=======================================
--- /branches/aaron-tcp_stats_cleanup/src/web100srv.c Mon Mar 10 13:41:09 2014 UTC
+++ /branches/aaron-tcp_stats_cleanup/src/web100srv.c Mon Mar 10 13:41:40 2014 UTC
@@ -2601,20 +2601,11 @@
"pid=%d", chld_pipe[0], chld_pipe[1], chld_pid);
close(listenfd);
close(chld_pipe[1]);
-#if USE_WEB100
- if ((agent = web100_attach(WEB100_AGENT_TYPE_LOCAL,
- NULL)) == NULL) {
- web100_perror("web100_attach");
+
+ if ((agent = tcp_stats_init_agent()) == NULL) {
+ log_println(0, "Unable to initialize TCP stats collection");
return 1;
}
-#elif USE_WEB10G
- if (estats_nl_client_init(&agent) != NULL) {
- log_println(0,
- "Error: estats_client_init failed."
- "Unable to use web10g.");
- return 1;
- }
-#endif

// This is the child process from the above fork(). The parent
// is in control, and will send this child a signal when it gets
@@ -2738,11 +2729,9 @@
child_sig(0);
}
close(ctlsockfd);
-#if USE_WEB100
- web100_detach(agent);
-#elif USE_WEB10G
- estats_nl_client_destroy(&agent);
-#endif
+
+ tcp_stats_free_agent(agent);
+
// log_free(); // Don't free the log we use it all the time
// log_println()
// Also makes valgrind angry
=======================================
--- /branches/aaron-tcp_stats_cleanup/src/web100srv.h Mon Mar 10 13:41:09 2014 UTC
+++ /branches/aaron-tcp_stats_cleanup/src/web100srv.h Mon Mar 10 13:41:40 2014 UTC
@@ -309,6 +309,8 @@

// Generic functions that, at compile-time, reads either from web10g or web100
int tcp_stats_init(char *VarFileName);
+tcp_stat_agent *tcp_stats_init_agent();
+void tcp_stats_free_agent(tcp_stat_agent *agent);
int tcp_stats_snap_read_var(tcp_stat_agent *agent, tcp_stat_snap *snap, const char *var_name);
void tcp_stats_set_cwnd(tcp_stat_agent *agent, tcp_stat_connection cn, uint32_t cwnd);



  • [ndt-dev] [ndt] r992 committed - Add tcp_stat_init_agent and tcp_stats_free_agent, ndt, 03/10/2014

Archive powered by MHonArc 2.6.16.

Top of Page