mirror of https://github.com/0intro/wmii
fixed a small bug in wmiifs and wmiikeys, if a mounted 9P server dies, the client of wmiifs is closed as well and doesn;t waits forever ;)
This commit is contained in:
parent
b2e81933e8
commit
319642b201
|
@ -100,6 +100,8 @@ xunbind(Bind *b) {
|
||||||
cext_array_detach((void **)bind, b, &bindsz);
|
cext_array_detach((void **)bind, b, &bindsz);
|
||||||
nbind--;
|
nbind--;
|
||||||
ixp_client_deinit(&b->client);
|
ixp_client_deinit(&b->client);
|
||||||
|
if(b->tx && b->tx->close)
|
||||||
|
b->tx->close(b->tx);
|
||||||
free(b);
|
free(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +115,7 @@ close_rx_conn(IXPConn *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bind *
|
static Bind *
|
||||||
xbind(char *address, unsigned int fid, IXPConn *tx)
|
xbind(char *address, unsigned int fid)
|
||||||
{
|
{
|
||||||
char addr[256];
|
char addr[256];
|
||||||
Bind *b = cext_emallocz(sizeof(Bind));
|
Bind *b = cext_emallocz(sizeof(Bind));
|
||||||
|
@ -124,7 +126,6 @@ xbind(char *address, unsigned int fid, IXPConn *tx)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
b->rx = ixp_server_open_conn(&srv, b->client.fd, do_mnt_fcall, close_rx_conn);
|
b->rx = ixp_server_open_conn(&srv, b->client.fd, do_mnt_fcall, close_rx_conn);
|
||||||
b->tx = tx;
|
|
||||||
bind = (Bind **)cext_array_attach((void **)bind, b, sizeof(Bind *), &bindsz);
|
bind = (Bind **)cext_array_attach((void **)bind, b, sizeof(Bind *), &bindsz);
|
||||||
nbind++;
|
nbind++;
|
||||||
return b;
|
return b;
|
||||||
|
@ -390,7 +391,7 @@ xwalk(IXPConn *c, Fcall *fcall)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
Bind *b;
|
Bind *b;
|
||||||
|
|
||||||
if(!(b = xbind(mnt->address, fcall->fid, c)))
|
if(!(b = xbind(mnt->address, fcall->fid)))
|
||||||
return Enoserv;
|
return Enoserv;
|
||||||
|
|
||||||
memcpy(&b->client.fcall, fcall, sizeof(Fcall));
|
memcpy(&b->client.fcall, fcall, sizeof(Fcall));
|
||||||
|
@ -408,6 +409,7 @@ xwalk(IXPConn *c, Fcall *fcall)
|
||||||
xunbind(b);
|
xunbind(b);
|
||||||
return Enofile;
|
return Enofile;
|
||||||
}
|
}
|
||||||
|
b->tx = c;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -637,6 +637,8 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||||
destroy_key(k);
|
destroy_key(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!fcall->count)
|
||||||
|
break;
|
||||||
memcpy(fcallbuf, fcall->data, fcall->count);
|
memcpy(fcallbuf, fcall->data, fcall->count);
|
||||||
fcallbuf[fcall->count] = 0;
|
fcallbuf[fcall->count] = 0;
|
||||||
if(fcall->offset) {
|
if(fcall->offset) {
|
||||||
|
@ -656,6 +658,8 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||||
memcpy(last, fcall->data, fcall->count);
|
memcpy(last, fcall->data, fcall->count);
|
||||||
while(p2 - fcallbuf < fcall->count) {
|
while(p2 - fcallbuf < fcall->count) {
|
||||||
p1 = strchr(p2, '\n');
|
p1 = strchr(p2, '\n');
|
||||||
|
if(!p1)
|
||||||
|
return "cannot grab, no \n supplied";
|
||||||
*p1 = 0;
|
*p1 = 0;
|
||||||
k = create_key(p2);
|
k = create_key(p2);
|
||||||
key = (Key **)cext_array_attach((void **)key, k, sizeof(Key *), &keysz);
|
key = (Key **)cext_array_attach((void **)key, k, sizeof(Key *), &keysz);
|
||||||
|
|
Loading…
Reference in New Issue