Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-stream
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-stream
Commits
eca304df
Commit
eca304df
authored
5 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[+] Added inheritor for session object
parent
85398ae2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
session/dap_stream_session.c
+17
-8
17 additions, 8 deletions
session/dap_stream_session.c
session/dap_stream_session.h
+6
-1
6 additions, 1 deletion
session/dap_stream_session.h
with
23 additions
and
9 deletions
session/dap_stream_session.c
+
17
−
8
View file @
eca304df
...
@@ -142,20 +142,29 @@ int dap_stream_session_close(unsigned int id)
...
@@ -142,20 +142,29 @@ int dap_stream_session_close(unsigned int id)
return
stream_session_close2
(
l_s
);
return
stream_session_close2
(
l_s
);
}
}
int
stream_session_close2
(
dap_stream_session_t
*
s
)
int
stream_session_close2
(
dap_stream_session_t
*
a_session
)
{
{
// log_it(L_INFO,"Close session");
// log_it(L_INFO,"Close session");
HASH_DEL
(
sessions
,
s
);
HASH_DEL
(
sessions
,
a_session
);
free
(
s
);
if
(
a_session
->
callback_delete
)
a_session
->
callback_delete
(
a_session
,
NULL
);
if
(
a_session
->
_inheritor
)
DAP_DELETE
(
a_session
->
_inheritor
);
DAP_DELETE
(
a_session
);
return
0
;
return
0
;
}
}
int
dap_stream_session_open
(
dap_stream_session_t
*
ss
)
/**
* @brief dap_stream_session_open
* @param a_session
* @return
*/
int
dap_stream_session_open
(
dap_stream_session_t
*
a_session
)
{
{
int
ret
;
int
ret
;
pthread_mutex_lock
(
&
ss
->
mutex
);
pthread_mutex_lock
(
&
a_session
->
mutex
);
ret
=
ss
->
opened
;
ret
=
a_session
->
opened
;
if
(
ss
->
opened
==
0
)
ss
->
opened
=
1
;
if
(
a_session
->
opened
==
0
)
a_session
->
opened
=
1
;
pthread_mutex_unlock
(
&
ss
->
mutex
);
pthread_mutex_unlock
(
&
a_session
->
mutex
);
return
ret
;
return
ret
;
}
}
This diff is collapsed.
Click to expand it.
session/dap_stream_session.h
+
6
−
1
View file @
eca304df
...
@@ -34,6 +34,9 @@
...
@@ -34,6 +34,9 @@
typedef
enum
stream_session_type
{
STREAM_SESSION_TYPE_MEDIA
=
0
,
STREAM_SESSION_TYPE_VPN
}
stream_session_type_t
;
typedef
enum
stream_session_type
{
STREAM_SESSION_TYPE_MEDIA
=
0
,
STREAM_SESSION_TYPE_VPN
}
stream_session_type_t
;
typedef
enum
stream_session_connection_type
{
STEAM_SESSION_HTTP
=
0
,
STREAM_SESSION_UDP
,
STREAM_SESSION_END_TYPE
}
stream_session_connection_type_t
;
typedef
enum
stream_session_connection_type
{
STEAM_SESSION_HTTP
=
0
,
STREAM_SESSION_UDP
,
STREAM_SESSION_END_TYPE
}
stream_session_connection_type_t
;
typedef
struct
dap_stream_session
dap_stream_session_t
;
typedef
void
(
*
dap_stream_session_callback_t
)(
dap_stream_session_t
*
,
void
*
);
struct
dap_stream_session
{
struct
dap_stream_session
{
bool
create_empty
;
bool
create_empty
;
unsigned
int
id
;
unsigned
int
id
;
...
@@ -57,6 +60,8 @@ struct dap_stream_session {
...
@@ -57,6 +60,8 @@ struct dap_stream_session {
struct
in_addr
tun_client_addr
;
struct
in_addr
tun_client_addr
;
void
*
_inheritor
;
void
*
_inheritor
;
dap_stream_session_callback_t
callback_delete
;
};
};
typedef
struct
dap_stream_session
dap_stream_session_t
;
typedef
struct
dap_stream_session
dap_stream_session_t
;
...
@@ -66,6 +71,6 @@ void dap_stream_session_deinit();
...
@@ -66,6 +71,6 @@ void dap_stream_session_deinit();
dap_stream_session_t
*
dap_stream_session_pure_new
();
dap_stream_session_t
*
dap_stream_session_pure_new
();
dap_stream_session_t
*
dap_stream_session_new
(
unsigned
int
media_id
,
bool
open_preview
);
dap_stream_session_t
*
dap_stream_session_new
(
unsigned
int
media_id
,
bool
open_preview
);
dap_stream_session_t
*
dap_stream_session_id
(
unsigned
int
id
);
dap_stream_session_t
*
dap_stream_session_id
(
unsigned
int
id
);
int
dap_stream_session_open
(
dap_stream_session_t
*
ss
);
/*Lock for opening for single client , return 0 if ok*/
int
dap_stream_session_open
(
dap_stream_session_t
*
a_session
);
/*Lock for opening for single client , return 0 if ok*/
int
dap_stream_session_close
(
unsigned
int
id
);
int
dap_stream_session_close
(
unsigned
int
id
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment