netns: Remove the explicit client connected flag.
Use the client variable directly.
This commit is contained in:
parent
73b14f17b8
commit
b1de00be1a
1 changed files with 2 additions and 8 deletions
|
@ -26,7 +26,6 @@ typedef struct vcmdentry {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
|
|
||||||
vnode_client_t *_client;
|
vnode_client_t *_client;
|
||||||
int _client_connected;
|
|
||||||
} VCmd;
|
} VCmd;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -385,7 +384,6 @@ static PyObject *VCmd_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
self->_client = NULL;
|
self->_client = NULL;
|
||||||
self->_client_connected = 0;
|
|
||||||
|
|
||||||
return (PyObject *)self;
|
return (PyObject *)self;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +406,6 @@ static void vcmd_ioerrorcb(vnode_client_t *client)
|
||||||
assert(self);
|
assert(self);
|
||||||
assert(self->_client == client);
|
assert(self->_client == client);
|
||||||
|
|
||||||
self->_client_connected = 0;
|
|
||||||
if (self->_client)
|
if (self->_client)
|
||||||
{
|
{
|
||||||
vnode_delclient(self->_client);
|
vnode_delclient(self->_client);
|
||||||
|
@ -478,8 +475,6 @@ static int VCmd_init(VCmd *self, PyObject *args, PyObject *kwds)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->_client_connected = 1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +484,6 @@ static void VCmd_dealloc(VCmd *self)
|
||||||
WARNX("%p: enter", self);
|
WARNX("%p: enter", self);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
self->_client_connected = 0;
|
|
||||||
if (self->_client)
|
if (self->_client)
|
||||||
{
|
{
|
||||||
vcmd_delclientreq_t delclreq = {.vcmd = self};
|
vcmd_delclientreq_t delclreq = {.vcmd = self};
|
||||||
|
@ -504,7 +498,7 @@ static void VCmd_dealloc(VCmd *self)
|
||||||
|
|
||||||
static PyObject *VCmd_connected(VCmd *self, PyObject *args, PyObject *kwds)
|
static PyObject *VCmd_connected(VCmd *self, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
if (self->_client_connected)
|
if (self->_client != NULL)
|
||||||
Py_RETURN_TRUE;
|
Py_RETURN_TRUE;
|
||||||
else
|
else
|
||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
|
@ -600,7 +594,7 @@ static PyObject *_VCmd_cmd(VCmd *self, PyObject *args, PyObject *kwds,
|
||||||
PyObject *pyptyfile = NULL;
|
PyObject *pyptyfile = NULL;
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
if (!self->_client_connected)
|
if (self->_client == NULL)
|
||||||
{
|
{
|
||||||
PyErr_SetString(PyExc_ValueError, "not connected");
|
PyErr_SetString(PyExc_ValueError, "not connected");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue