From: adhavan.m Date: Fri, 25 May 2018 14:08:36 +0000 (+0530) Subject: Notify server in case of read failure before closing the connection X-Git-Tag: submit/tizen/20180605.140738~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9f542bc1c851cec9f2e67c3b0e2307c84db9ee1;p=sdk%2Ftarget%2Fsdbd.git Notify server in case of read failure before closing the connection Change-Id: Ia182b530759e81a6fee703222aa067e2ae8e347e Signed-off-by: adhavan.m --- diff --git a/src/sdb.h b/src/sdb.h index 5be6f89..a603692 100644 --- 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 diff --git a/src/transport.c b/src/transport.c index a5df573..5769a2a 100644 --- a/src/transport.c +++ b/src/transport.c @@ -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);