aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_server_network.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-08-04 16:14:38 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-08-04 16:14:38 +0200
commit2899428be2aac2fb1e5edd6e8c90174bb1dd0a36 (patch)
tree6b5570f9d3940a6f5a5f36a3151ec0931b16dc76 /src/osmo_server_network.c
parent9646754e1f82d3b846304dc5803d520641064ba4 (diff)
server: Add a config knob to not store the pcap stream
We might only want to centralize the data streams but handle the data differently. This will be combined with an upcoming ZeroMQ publisher feature to broadcast all events out. Change-Id: I12c6bf16310820d882fa28c6930931650475e0bb
Diffstat (limited to 'src/osmo_server_network.c')
-rw-r--r--src/osmo_server_network.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c
index 7127401..d530ef7 100644
--- a/src/osmo_server_network.c
+++ b/src/osmo_server_network.c
@@ -62,6 +62,12 @@ static void restart_pcap(struct osmo_pcap_conn *conn)
conn->local_fd = -1;
}
+ /* omit any storing/creation of the file */
+ if (conn->no_store) {
+ conn->last_write = *tm;
+ return;
+ }
+
filename = talloc_asprintf(conn, "%s/trace-%s-%d%.2d%.2d_%.2d%.2d%.2d.pcap",
conn->server->base_path, conn->name,
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
@@ -103,7 +109,7 @@ static void link_data(struct osmo_pcap_conn *conn, struct osmo_pcap_data *data)
}
hdr = (struct pcap_file_header *) &data->data[0];
- if (conn->local_fd < 0) {
+ if (!conn->no_store && conn->local_fd < 0) {
conn->file_hdr = *hdr;
restart_pcap(conn);
} else if (memcmp(&conn->file_hdr, hdr, sizeof(*hdr)) != 0) {
@@ -121,6 +127,11 @@ static void write_data(struct osmo_pcap_conn *conn, struct osmo_pcap_data *data)
struct tm *tm = localtime(&now);
int rc;
+ if (conn->no_store) {
+ conn->last_write = *tm;
+ return;
+ }
+
if (conn->local_fd < -1) {
LOGP(DSERVER, LOGL_ERROR, "No file is open. close connection.\n");
close_connection(conn);