Skip to content

Commit

Permalink
fixed lick bug where a shut port will still send soaks and errors if …
Browse files Browse the repository at this point in the history
…somethign is connected
  • Loading branch information
mopfel-winrux committed Dec 4, 2023
1 parent 65f03b3 commit b95f228
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions 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 @@ -181,12 +182,16 @@ _lick_moor_poke(void* ptr_v, c3_d len_d, c3_y* byt_y)
return;
}

wir = u3nc(c3__lick, u3_nul);
dev = _lick_string_to_path(gen_u->nam_c+1);
cad = u3nt(c3__soak, dev, put);
u3_auto_peer(
u3_auto_plan(&lic_u->car_u, u3_ovum_init(0, c3__l, wir, cad)),
0, 0, 0);
if ( c3y == gen_u->liv_o ) {
wir = u3nc(c3__lick, u3_nul);
dev = _lick_string_to_path(gen_u->nam_c+1);
cad = u3nt(c3__soak, dev, put);
u3_auto_peer(
u3_auto_plan(&lic_u->car_u, u3_ovum_init(0, c3__l, wir, cad)),
0, 0, 0);
} else {
u3z(put);
}
}

/* _lick_close_chan(): close given channel, freeing.
Expand Down Expand Up @@ -214,7 +219,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 @@ -423,6 +428,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 +468,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

0 comments on commit b95f228

Please sign in to comment.