Event handling and job reaping updates

darcs-hash:20051011192343-ac50b-aa3f5ae5e2b34d122f10e3b59ceb6fdd447f4ae3.gz
This commit is contained in:
axel
2005-10-12 05:23:43 +10:00
parent 0a4b983afa
commit 838ba08eaa
17 changed files with 209 additions and 92 deletions

View File

@@ -163,9 +163,20 @@ void read_message( connection_t *src )
{
if( res == L'\n' )
{
parse_message( (wchar_t *)src->input.buff, src );
/*
Before calling parse_message, we must empty reset
everything, since the callback function could
potentially call read_message.
*/
wchar_t *msg = wcsdup( (wchar_t *)src->input.buff );
sb_clear( &src->input );
memset (&src->wstate, '\0', sizeof (mbstate_t));
memset (&src->wstate, '\0', sizeof (mbstate_t));
parse_message( msg, src );
free( msg );
}
else
{
@@ -203,7 +214,7 @@ static void parse_message( wchar_t *msg,
connection_t *src )
{
debug( 2, L"parse_message( %ls );", msg );
if( msg[0] == L'#' )
return;