Explorar el Código

unetmsg: return the request data when issuing async requests

Makes it possible to track and cancel requests

Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau hace 7 meses
padre
commit
a242cfb4e1

+ 4 - 2
package/network/services/unetmsg/files/usr/share/ucode/unetmsg/client.uc

@@ -76,8 +76,10 @@ function request(name, type, data, data_cb, complete_cb)
 		cb: complete_cb
 	});
 
-	if (!complete_cb)
-		req.await();
+	if (complete_cb)
+		return req;
+
+	req.await();
 }
 
 function connect()