Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lick: Shut bug #563

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pkg/vere/io/lick.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef struct _u3_shan {
typedef struct _u3_port {
c3_c* nam_c; // name of port
c3_o con_o;
c3_o liv_o;
struct _u3_shan* san_u; // server reference
struct _u3_lick* lic_u; // device backpointer
struct _u3_port* nex_u; // next pointer
Expand Down Expand Up @@ -214,7 +215,7 @@ _lick_close_chan(u3_chan* can_u)
}
can_u->mor_u.nex_u = NULL;

if ( NULL == san_u->can_u ) {
if ( NULL == san_u->can_u && c3y == gen_u->liv_o ) {
// send a close event to arvo and stop reading.
//
u3_noun wir, cad, dev, dat, mar;
Expand Down Expand Up @@ -301,6 +302,11 @@ static void
_lick_close_sock(u3_shan* san_u)
{
u3_lick* lic_u = san_u->gen_u->lic_u;

if ( NULL != san_u->can_u ) {
_lick_close_chan(san_u->can_u);
}

c3_w len_w = strlen(lic_u->fod_c) + strlen(san_u->gen_u->nam_c) + 2;
c3_c* paf_c = c3_malloc(len_w);
c3_i wit_i;
Expand Down Expand Up @@ -423,6 +429,7 @@ _lick_ef_shut(u3_lick* lic_u, u3_noun nam)

while ( NULL != cur_u ) {
if ( 0 == strcmp(cur_u->nam_c, nam_c) ) {
cur_u->liv_o = c3n;
_lick_close_sock(cur_u->san_u);
if( las_u == NULL ) {
lic_u->gen_u = cur_u->nex_u;
Expand Down Expand Up @@ -462,6 +469,7 @@ _lick_ef_spin(u3_lick* lic_u, u3_noun nam)
gen_u->san_u->gen_u = gen_u;
gen_u->nam_c = nam_c;
gen_u->con_o = c3n;
gen_u->liv_o = c3y;

_lick_init_sock(gen_u->san_u);
if ( NULL == las_u) {
Expand Down