Factor out checking msg for NULL
Simplify 'if' branch
Replay the event buffer *then* send new messages
Refactor handling of socket/fifo/stdin input
Free the expiration time
Move ownership of the path down
Merge branch 'mathstuf/dev/cleanup' into mathstuf/next

* mathstuf/dev/cleanup:
  Move ownership of the path down
  Free the expiration time
  Refactor handling of socket/fifo/stdin input
  Replay the event buffer *then* send new messages
  Simplify 'if' branch
  Factor out checking msg for NULL