Notify server in case of read failure before closing the connection 37/180237/1
authoradhavan.m <adhavan.m@samsung.com>
Fri, 25 May 2018 14:08:36 +0000 (19:38 +0530)
committeradhavan.m <adhavan.m@samsung.com>
Fri, 25 May 2018 14:08:36 +0000 (19:38 +0530)
Change-Id: Ia182b530759e81a6fee703222aa067e2ae8e347e
Signed-off-by: adhavan.m <adhavan.m@samsung.com>
src/sdb.h
src/transport.c

index 5be6f89..a603692 100644 (file)
--- a/src/sdb.h
+++ b/src/sdb.h
@@ -37,6 +37,7 @@
 #define A_CLSE 0x45534c43
 #define A_WRTE 0x45545257
 #define A_STAT 0x54415453
+#define A_TCLS 0x534C4354
 #define A_ENCR 0x40682018 // encryption 메시지
 
 #ifdef SUPPORT_ENCRYPT
index a5df573..5769a2a 100644 (file)
@@ -327,7 +327,9 @@ static void *output_thread(void *_t)
     if(write_packet(t->fd, t->serial, &p)) {
         put_apacket(p);
         E("%s: failed to write SYNC apacket to transport", t->serial);
+        goto oops;
     }
+    return 0;
 
 oops:
     D("%s: transport output thread is exiting, fd %d, sfd %d\n", t->serial, t->fd, t->sfd);
@@ -397,6 +399,13 @@ static void *input_thread(void *_t)
         put_apacket(p);
     }
 
+    D("Input thread out of loop before sending TCLS to server\n");
+    p = get_apacket();
+    p->msg.command = A_TCLS;
+    t->write_to_remote(p, t);
+    D("TCLS sent to server\n");
+    put_apacket(p);
+
     // this is necessary to avoid a race condition that occured when a transport closes
     // while a client socket is still active.
     close_all_sockets(t);