From: Kim Gunsoo Date: Tue, 18 Oct 2016 07:18:17 +0000 (+0900) Subject: Fixed the bug that transport with same serial are multiple generation. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d48db3d0c97d8f295419a7acd60c7288e1d6601f;p=sdk%2Ftools%2Fsdb.git Fixed the bug that transport with same serial are multiple generation. - There was a bug in the code that checks whether the transport with the same serial name, was solved. Change-Id: I8418c88f7751495d02434586b22bc1e16c28a751 Signed-off-by: Kim Gunsoo --- diff --git a/src/command_function.c b/src/command_function.c index b7c8845..bf8670e 100644 --- a/src/command_function.c +++ b/src/command_function.c @@ -339,6 +339,9 @@ int __connect(int argc, char ** argv) { if(!strcmp(tmp, STATE_DEVICE) || !strcmp(tmp, STATE_LOCKED) || !strcmp(tmp, STATE_SUSPENDED)) { printf("connected to %s\n", remote_target_info); return 0; + } else if (!strcmp(tmp, STATE_UNAUTHORIZED)) { + printf("device unauthorized. Please approve on your device.\n"); + return 1; } } else { // connection error occurred diff --git a/src/sockets.c b/src/sockets.c index d8428e0..68e14d2 100755 --- a/src/sockets.c +++ b/src/sockets.c @@ -31,6 +31,7 @@ #include "listener.h" #include "sdb.h" #include "sdb_messages.h" +#include "adb_auth.h" #define TRACE_TAG TRACE_SOCKETS @@ -1323,6 +1324,16 @@ static int smart_socket_enqueue(SDB_SOCKET *s, PACKET *p) s->transport = t; sdb_write(s->fd, "OKAY", 4); D("LS(%X) get transport T(%s)", s->local_id, t->serial); + } else if (t && t->connection_state == CS_UNAUTHORIZED) { + if (t->target_type == TARGET_NO_SCREEN) { + err_str = MSG_UNAUTHORIZE_NO_SCREEN; + } else { + err_str = MSG_UNAUTHORIZE; + } + + LOG_ERROR("LS(%X) transport is unauthorized.", s->local_id); + sendfailmsg(s->fd, err_str); + goto fail; } else { if(t != NULL) { if(t->suspended) { diff --git a/src/transport.c b/src/transport.c index 5a1a83b..672786f 100755 --- a/src/transport.c +++ b/src/transport.c @@ -619,17 +619,6 @@ TRANSPORT *acquire_one_transport(transport_type ttype, const char* serial, char* if (result == NULL ) { *error_out = error_message(SDB_MESSAGE_ERROR, ERR_CONNECT_TARGET_NOT_FOUND, NULL); - } else { - if (result->connection_state == CS_UNAUTHORIZED) { - if (error_out) { - if(result->target_type == TARGET_NO_SCREEN) - *error_out = MSG_UNAUTHORIZE_NO_SCREEN; - else - *error_out = MSG_UNAUTHORIZE; - } - result = NULL; - goto exit; - } } exit: