Fixed routing of messages to respective buffers.

Routing now happens in a separate task, s.t. there can be no race conditions
when reading events or messages. The application simply reads from the
eventbuffer if it wants an event, and from the replybuffer if it expects a
reply.