From 08b5b16126adf5a1d4b3e228c85a7409598c151e Mon Sep 17 00:00:00 2001
From: Aleksandr Lysikov <lysikov@inbox.ru>
Date: Fri, 17 May 2019 18:04:20 +0500
Subject: [PATCH] moved service_key from dap_stream_t to dap_stream_session

---
 session/dap_stream_session.h | 1 +
 stream/dap_stream.c          | 2 +-
 stream/dap_stream.h          | 2 --
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/session/dap_stream_session.h b/session/dap_stream_session.h
index 7d7c534..bbd794e 100755
--- a/session/dap_stream_session.h
+++ b/session/dap_stream_session.h
@@ -46,6 +46,7 @@ struct dap_stream_session {
 
     uint8_t enc_type;
 
+    char *service_key;// auth string
     char active_channels[16];// channels for open
 
     stream_session_connection_type_t conn_type;
diff --git a/stream/dap_stream.c b/stream/dap_stream.c
index 238e0a5..7fdba43 100755
--- a/stream/dap_stream.c
+++ b/stream/dap_stream.c
@@ -170,7 +170,7 @@ void stream_headers_read(dap_http_client_t * cl_ht, void * arg)
                     sid->session=ss;
                     dap_http_header_t *header = dap_http_header_find(cl_ht->in_headers, "Service-Key");
                     if (header)
-                        sid->service_key = strdup(header->value);
+                        ss->service_key = strdup(header->value);
                     size_t count_channels = strlen(ss->active_channels);
                     for(size_t i = 0; i < count_channels; i++) {
                         dap_stream_ch_new(sid, ss->active_channels[i]);
diff --git a/stream/dap_stream.h b/stream/dap_stream.h
index 1fe1807..2a149cc 100755
--- a/stream/dap_stream.h
+++ b/stream/dap_stream.h
@@ -83,8 +83,6 @@ typedef struct dap_stream {
     dap_stream_ch_t * channel[255]; // TODO reduce channels to 16 to economy memory
     size_t channel_count;
 
-    char *service_key;
-
     size_t frame_sent; // Frame counter
 
     size_t seq_id;
-- 
GitLab