Eh. I made a mistake in the read_callback.
void read_callback( ... ) { while( mixed msg = protocol_parser->feed( data ) ) { process_async_msg( msg ); data=""; } }
/ Per Hedbor ()
Previous text:
2003-03-19 15:58: Subject: I/O callbacks in blocking mode
I can always take an example from the metaserver communication in AIDO.
void read_callback( ... ) { while( mixed msg = protocol_parser->feed( data ) ) process_async_msg( msg ); }
mixed do_command( ... ) { fd->write( encode_command( command ) ); while( mixed msg = protocol_parser->feed( fd->read( 2048, 1 ) ) ) if( msg->type == REPLY ) return msg->payload; else process_async_msg( msg ); }
/ Per Hedbor ()