added MIO_DEV_CAP_WATCH_STARTED to fix a bug
This commit is contained in:
parent
1f8372f35d
commit
bf595d51f1
@ -826,7 +826,6 @@ static int cgi_peer_on_read (mio_dev_pro_t* pro, mio_dev_pro_sid_t sid, const vo
|
||||
|
||||
MIO_ASSERT (mio, !(cgi_state->over & CGI_STATE_OVER_READ_FROM_PEER));
|
||||
|
||||
printf ("FEED %d BYTES TO HTRD\n", (int)dlen);
|
||||
if (mio_htrd_feed(cgi_state->peer_htrd, data, dlen, &rem) <= -1)
|
||||
{
|
||||
MIO_DEBUG3 (mio, "HTTPS(%p) - unable to feed peer into to htrd - peer %p(pid=%u)\n", cgi_state->htts, pro, (unsigned int)pro->child_pid);
|
||||
|
@ -1044,6 +1044,8 @@ int mio_dev_watch (mio_dev_t* dev, mio_dev_watch_cmd_t cmd, int events)
|
||||
if (dev->dev_cap & MIO_DEV_CAP_VIRTUAL) return 0;
|
||||
|
||||
/*ev.data.ptr = dev;*/
|
||||
dev_cap = dev->dev_cap & ~(DEV_CAP_ALL_WATCHED);
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case MIO_DEV_WATCH_START:
|
||||
@ -1053,6 +1055,7 @@ int mio_dev_watch (mio_dev_t* dev, mio_dev_watch_cmd_t cmd, int events)
|
||||
* after this 'switch' block */
|
||||
events = MIO_DEV_EVENT_IN;
|
||||
mux_cmd = MIO_SYS_MUX_CMD_INSERT;
|
||||
dev_cap |= MIO_DEV_CAP_WATCH_STARTED;
|
||||
break;
|
||||
|
||||
case MIO_DEV_WATCH_RENEW:
|
||||
@ -1072,10 +1075,10 @@ int mio_dev_watch (mio_dev_t* dev, mio_dev_watch_cmd_t cmd, int events)
|
||||
break;
|
||||
|
||||
case MIO_DEV_WATCH_STOP:
|
||||
if (!(dev->dev_cap & DEV_CAP_ALL_WATCHED)) return 0; /* the device is not being watched */
|
||||
if (!(dev_cap & MIO_DEV_CAP_WATCH_STARTED)) return 0; /* the device is not being watched */
|
||||
events = 0; /* override events */
|
||||
mux_cmd = MIO_SYS_MUX_CMD_DELETE;
|
||||
dev_cap = dev->dev_cap & ~(DEV_CAP_ALL_WATCHED);
|
||||
dev_cap &= ~MIO_DEV_CAP_WATCH_STARTED;
|
||||
goto ctrl_mux;
|
||||
|
||||
default:
|
||||
@ -1083,7 +1086,6 @@ int mio_dev_watch (mio_dev_t* dev, mio_dev_watch_cmd_t cmd, int events)
|
||||
return -1;
|
||||
}
|
||||
|
||||
dev_cap = dev->dev_cap & ~(DEV_CAP_ALL_WATCHED);
|
||||
|
||||
/* this function honors MIO_DEV_EVENT_IN and MIO_DEV_EVENT_OUT only
|
||||
* as valid input event bits. it intends to provide simple abstraction
|
||||
|
@ -389,7 +389,8 @@ enum mio_dev_cap_t
|
||||
MIO_DEV_CAP_ACTIVE = (1 << 15),
|
||||
MIO_DEV_CAP_HALTED = (1 << 16),
|
||||
MIO_DEV_CAP_ZOMBIE = (1 << 17),
|
||||
MIO_DEV_CAP_RENEW_REQUIRED = (1 << 18)
|
||||
MIO_DEV_CAP_RENEW_REQUIRED = (1 << 18),
|
||||
MIO_DEV_CAP_WATCH_STARTED = (1 << 19)
|
||||
};
|
||||
typedef enum mio_dev_cap_t mio_dev_cap_t;
|
||||
|
||||
|
@ -326,7 +326,7 @@ static int dev_sck_make_client (mio_dev_t* dev, void* ctx)
|
||||
{
|
||||
mio_t* mio = dev->mio;
|
||||
mio_dev_sck_t* rdev = (mio_dev_sck_t*)dev;
|
||||
mio_syshnd_t* sck = (mio_syshnd_t*)ctx;
|
||||
mio_syshnd_t* clisckhnd = (mio_syshnd_t*)ctx;
|
||||
|
||||
/* create a socket device that is made of a socket connection
|
||||
* on a listening socket.
|
||||
@ -334,7 +334,7 @@ static int dev_sck_make_client (mio_dev_t* dev, void* ctx)
|
||||
* most of the initialization is done by the listening socket device
|
||||
* after a client socket has been created. */
|
||||
|
||||
rdev->hnd = *sck;
|
||||
rdev->hnd = *clisckhnd;
|
||||
rdev->tmrjob_index = MIO_TMRIDX_INVALID;
|
||||
|
||||
if (mio_makesckasync(mio, rdev->hnd) <= -1) return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user