From 2800b7bf007e32b2606d0f33edf27ac372182c88 Mon Sep 17 00:00:00 2001
From: dimitri staessens <dimitri.staessens@intec.ugent.be>
Date: Sun, 3 Jul 2016 15:26:07 +0200
Subject: irmd: fix missing gbp messages

When empty, gpb does not send a message. Functions that return null
will now send a message with return value set to -1.
---
 src/irmd/main.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/irmd/main.c b/src/irmd/main.c
index b14aa213..6e3fd74a 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -2106,8 +2106,11 @@ void * mainloop()
                                         msg->ap_name,
                                         &ret_msg.ae_name);
 
-                        if (e == NULL)
+                        if (e == NULL) {
+                                ret_msg.has_result = true;
+                                ret_msg.result = -1;
                                 break;
+                        }
 
                         ret_msg.has_port_id = true;
                         ret_msg.port_id     = e->port_id;
@@ -2125,8 +2128,11 @@ void * mainloop()
                                        msg->dst_name,
                                        msg->ae_name,
                                        NULL);
-                        if (e == NULL)
+                        if (e == NULL) {
+                                ret_msg.has_result = true;
+                                ret_msg.result = -1;
                                 break;
+                        }
 
                         ret_msg.has_port_id = true;
                         ret_msg.port_id     = e->port_id;
@@ -2145,8 +2151,11 @@ void * mainloop()
                         e = flow_req_arr(msg->api,
                                          msg->dst_name,
                                          msg->ae_name);
-                        if (e == NULL)
+                        if (e == NULL) {
+                                ret_msg.has_result = true;
+                                ret_msg.result = -1;
                                 break;
+                        }
 
                         ret_msg.has_port_id = true;
                         ret_msg.port_id     = e->port_id;
-- 
cgit v1.2.3