Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-tus
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-tus
Commits
3a18bfbd
Unverified
Commit
3a18bfbd
authored
Jan 05, 2024
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a varnish lock for struct VPFX(tus_server)
parent
3a8b73eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
tus_servers.c
src/tus_servers.c
+2
-2
tus_servers.h
src/tus_servers.h
+1
-1
vmod_tus.c
src/vmod_tus.c
+9
-4
No files found.
src/tus_servers.c
View file @
3a18bfbd
...
...
@@ -84,7 +84,7 @@ tus_server_lock(struct VPFX(tus_server) *s)
{
CHECK_OBJ_NOTNULL
(
s
,
VMOD_TUS_SERVER_MAGIC
);
AZ
(
pthread_mutex_lock
(
&
s
->
mtx
)
);
Lck_Lock
(
&
s
->
mtx
);
}
void
...
...
@@ -92,7 +92,7 @@ tus_server_unlock(struct VPFX(tus_server) *s)
{
CHECK_OBJ_NOTNULL
(
s
,
VMOD_TUS_SERVER_MAGIC
);
AZ
(
pthread_mutex_unlock
(
&
s
->
mtx
)
);
Lck_Unlock
(
&
s
->
mtx
);
}
VCL_BYTES
...
...
src/tus_servers.h
View file @
3a18bfbd
...
...
@@ -44,7 +44,7 @@ struct VPFX(tus_server) {
VSPLAY_ENTRY
(
VPFX
(
tus_server
))
entry
;
pthread_mutex_t
mtx
;
struct
lock
mtx
;
char
*
vcl_name
;
char
*
basedir
;
char
*
schemeauth
;
...
...
src/vmod_tus.c
View file @
3a18bfbd
...
...
@@ -55,6 +55,7 @@
static
unsigned
refcnt
=
0
;
static
struct
vsc_seg
*
vsc_seg_lck
=
NULL
;
struct
VSC_lck
*
lck_fcore
=
NULL
;
static
struct
VSC_lck
*
lck_tussrv
=
NULL
;
/* ============================================================
* vmod init/fini
...
...
@@ -69,8 +70,12 @@ tus_init(VRT_CTX, struct vmod_priv *priv)
return
(
0
);
AZ
(
vsc_seg_lck
);
AZ
(
lck_fcore
);
lck_fcore
=
Lck_CreateClass
(
&
vsc_seg_lck
,
"tus.fcore"
);
AN
(
lck_fcore
);
AZ
(
lck_tussrv
);
lck_tussrv
=
Lck_CreateClass
(
&
vsc_seg_lck
,
"tus.server"
);
AN
(
lck_tussrv
);
tus_file_init
();
return
(
tus_chksum_init
(
ctx
));
}
...
...
@@ -207,7 +212,7 @@ tus_server_new(VRT_CTX, const char *vcl_name,
ALLOC_OBJ
(
tussrv
,
VMOD_TUS_SERVER_MAGIC
);
AN
(
tussrv
);
AZ
(
pthread_mutex_init
(
&
tussrv
->
mtx
,
NULL
)
);
Lck_New
(
&
tussrv
->
mtx
,
lck_tussrv
);
REPLACE
(
tussrv
->
vcl_name
,
vcl_name
);
REPLACE
(
tussrv
->
schemeauth
,
args
->
schemeauth
);
REPLACE
(
tussrv
->
basedir
,
basedir
);
...
...
@@ -277,9 +282,9 @@ tus_server__init(VRT_CTX, struct VPFX(tus_server) **tussrvp,
tussrv
->
expires
=
args
->
expires
;
tussrv
->
digest
=
d
;
AZ
(
pthread_mutex_lock
(
&
tussrv
->
mtx
)
);
Lck_Lock
(
&
tussrv
->
mtx
);
tus_file_load
(
tussrv
);
AZ
(
pthread_mutex_unlock
(
&
tussrv
->
mtx
)
);
Lck_Unlock
(
&
tussrv
->
mtx
);
*
tussrvp
=
tussrv
;
...
...
@@ -301,7 +306,7 @@ tus_server__fini(struct VPFX(tus_server) **tussrvp)
AZ
(
tussrv
->
exp
);
remove
=
VSPLAY_REMOVE
(
tus_servers
,
tus_servers
,
tussrv
);
assert
(
remove
==
tussrv
);
AZ
(
pthread_mutex_destroy
(
&
tussrv
->
mtx
)
);
Lck_Delete
(
&
tussrv
->
mtx
);
REPLACE
(
tussrv
->
vcl_name
,
NULL
);
REPLACE
(
tussrv
->
basedir
,
NULL
);
AZ
(
close
(
tussrv
->
basefd
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment