From 3159a44c3aa9bb58e0a12434b88d9dde5351c0a4 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 14 Jun 2018 00:02:10 -0500 Subject: [PATCH] Returning -1 if no message was sent --- .../cy/agorise/graphenej/api/android/NetworkService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java index 2de6712..1e85968 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java @@ -142,11 +142,12 @@ public class NetworkService extends Service { if(mWebSocket != null){ if(mWebSocket.send(message)){ Log.v(TAG,"-> " + message); + return mCurrentId; } }else{ throw new RuntimeException("Websocket connection has not yet been established"); } - return mCurrentId; + return -1; } public long sendMessage(ApiCallable apiCallable, int requiredApi){ @@ -158,10 +159,9 @@ public class NetworkService extends Service { mRequestClassMap.put(mCurrentId, apiCallable.getClass()); if(mWebSocket != null && mWebSocket.send(call.toJsonString())){ Log.v(TAG,"-> "+call.toJsonString()); - }else{ - return -1; + return mCurrentId; } - return mCurrentId; + return -1; } /**