Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdp-pesi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
uplex-varnish
libvdp-pesi
Commits
77b89851
Unverified
Commit
77b89851
authored
Jun 12, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor error latching
parent
b2d66c4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
15 deletions
+20
-15
node.c
src/node.c
+12
-0
node.h
src/node.h
+1
-0
vdp_pesi.c
src/vdp_pesi.c
+7
-15
No files found.
src/node.c
View file @
77b89851
...
...
@@ -325,6 +325,18 @@ tree_free(struct vdp_ctx *vdx, struct node *node)
node_free
(
&
node
);
}
void
tree_latch_error
(
struct
bytes_tree
*
tree
,
int
retval
)
{
CHECK_OBJ_NOTNULL
(
tree
,
BYTES_TREE_MAGIC
);
AN
(
retval
);
Lck_Lock
(
&
tree
->
tree_lock
);
if
(
tree
->
retval
==
0
)
tree
->
retval
=
retval
;
Lck_Unlock
(
&
tree
->
tree_lock
);
}
/* ============================================================
* node insert / state transitions
*/
...
...
src/node.h
View file @
77b89851
...
...
@@ -251,6 +251,7 @@ void set_closed(struct bytes_tree *, struct node *);
void
tree_prune
(
struct
vdp_ctx
*
,
struct
node
*
);
void
tree_free
(
struct
vdp_ctx
*
,
struct
node
*
);
void
tree_latch_error
(
struct
bytes_tree
*
tree
,
int
retval
);
//--------------
...
...
src/vdp_pesi.c
View file @
77b89851
...
...
@@ -322,7 +322,7 @@ vped_include(struct req *preq, const char *src, const char *host,
VSLb
(
req
->
vsl
,
SLT_Error
,
"Cannot allocate workspace for parallel ESI data"
);
req_fini
(
&
req
,
wrk
);
tree
->
retval
=
-
1
;
tree
_latch_error
(
tree
,
-
1
)
;
return
(
-
1
);
}
...
...
@@ -539,11 +539,7 @@ pesi_buf_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
VSLdbg
(
vdx
,
"bytes_add: exit after transient alloc "
"failure"
);
Lck_Lock
(
&
tree
->
tree_lock
);
if
(
tree
->
retval
==
0
)
tree
->
retval
=
-
1
;
Lck_Unlock
(
&
tree
->
tree_lock
);
tree_latch_error
(
tree
,
-
1
);
node_free
(
&
node
);
return
(
tree
->
retval
);
...
...
@@ -1009,13 +1005,9 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
node_insert
(
tree
,
child
);
child
=
NULL
;
}
else
if
(
!
incl_cont
&&
tree
->
retval
==
0
)
{
Lck_Lock
(
&
tree
->
tree_lock
);
if
(
tree
->
retval
==
0
)
tree
->
retval
=
-
1
;
Lck_Unlock
(
&
tree
->
tree_lock
);
node_free
(
&
child
);
}
else
else
if
(
incl_cont
==
0
)
tree_latch_error
(
tree
,
-
1
);
if
(
child
!=
NULL
)
node_free
(
&
child
);
AZ
(
child
);
...
...
@@ -1106,8 +1098,8 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
break
;
}
}
if
(
retval
!=
0
&&
tree
->
retval
==
0
)
tree
->
retval
=
retval
;
if
(
retval
!=
0
)
tree
_latch_error
(
tree
,
retval
)
;
return
(
tree
->
retval
);
}
...
...
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