osmo_io: Assert that iofd mode is correct when calling *_write_msgb

Change-Id: Ief82ba7f9b280f85d66d68c358c36ba9866fe47a
Fixes: OS#6264
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 2b2b7dd..f23986f 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -356,6 +356,7 @@
 {
 	int rc;
 
+	OSMO_ASSERT(iofd->mode == OSMO_IO_FD_MODE_READ_WRITE);
 	if (OSMO_UNLIKELY(!iofd->io_ops.write_cb)) {
 		LOGPIO(iofd, LOGL_ERROR, "write_cb not set, Rejecting msgb\n");
 		return -EINVAL;