vici: Invoke dispatcher outside of connection log, allowing events from commands
This commit is contained in:
@@ -346,10 +346,6 @@ static bool do_read(private_vici_socket_t *this, entry_t *entry,
|
|||||||
entry->in.done += len;
|
entry->in.done += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->inbound(this->user, entry->id, entry->in.buf);
|
|
||||||
chunk_clear(&entry->in.buf);
|
|
||||||
entry->in.hdrlen = entry->in.done = 0;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,6 +355,7 @@ static bool do_read(private_vici_socket_t *this, entry_t *entry,
|
|||||||
CALLBACK(on_read, bool,
|
CALLBACK(on_read, bool,
|
||||||
entry_t *entry, stream_t *stream)
|
entry_t *entry, stream_t *stream)
|
||||||
{
|
{
|
||||||
|
chunk_t data = chunk_empty;
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
entry->mutex->lock(entry->mutex);
|
entry->mutex->lock(entry->mutex);
|
||||||
@@ -367,8 +364,20 @@ CALLBACK(on_read, bool,
|
|||||||
{
|
{
|
||||||
disconnect(entry->this, entry->id);
|
disconnect(entry->this, entry->id);
|
||||||
}
|
}
|
||||||
|
if (entry->in.buf.len == entry->in.done)
|
||||||
|
{
|
||||||
|
data = entry->in.buf;
|
||||||
|
entry->in.buf = chunk_empty;
|
||||||
|
entry->in.hdrlen = entry->in.done = 0;
|
||||||
|
}
|
||||||
entry->mutex->unlock(entry->mutex);
|
entry->mutex->unlock(entry->mutex);
|
||||||
|
|
||||||
|
if (data.len)
|
||||||
|
{
|
||||||
|
entry->this->inbound(entry->this->user, entry->id, data);
|
||||||
|
chunk_clear(&data);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user