mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-15 16:24:28 +08:00
Don't exit from reconnect mode if connection was denied.
This commit is contained in:
parent
6c76db6269
commit
89d41e2e6c
@ -120,12 +120,14 @@ int do_connect(char *svr)
|
||||
rem_addr.l2_psm = htobs(psm);
|
||||
if( connect(s, (struct sockaddr *)&rem_addr, sizeof(rem_addr)) < 0 ){
|
||||
syslog(LOG_ERR, "Can't connect. %s(%d)", strerror(errno), errno);
|
||||
close(s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
opt = sizeof(opts);
|
||||
if( getsockopt(s, SOL_L2CAP, L2CAP_OPTIONS, &opts, &opt) < 0 ){
|
||||
syslog(LOG_ERR, "Can't get L2CAP options. %s(%d)", strerror(errno), errno);
|
||||
close(s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -319,13 +321,8 @@ void send_mode(int s)
|
||||
void reconnect_mode(char *svr)
|
||||
{
|
||||
while(1) {
|
||||
int s;
|
||||
if( (s = do_connect(svr)) < 0 )
|
||||
exit(1);
|
||||
|
||||
int s = do_connect(svr);
|
||||
close(s);
|
||||
|
||||
usleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -337,7 +334,7 @@ void connect_mode(char *svr)
|
||||
sleep(99999999);
|
||||
}
|
||||
|
||||
void multy_connect_mode(char *svr)
|
||||
void multi_connect_mode(char *svr)
|
||||
{
|
||||
while (1) {
|
||||
int i, s;
|
||||
@ -346,10 +343,11 @@ void multy_connect_mode(char *svr)
|
||||
|
||||
/* Child */
|
||||
s = do_connect(svr);
|
||||
usleep(500);
|
||||
close(s);
|
||||
exit(0);
|
||||
}
|
||||
sleep(19);
|
||||
sleep(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,7 +515,7 @@ int main(int argc ,char *argv[])
|
||||
break;
|
||||
|
||||
case MULTY:
|
||||
multy_connect_mode(argv[optind]);
|
||||
multi_connect_mode(argv[optind]);
|
||||
break;
|
||||
|
||||
case CONNECT:
|
||||
|
Loading…
Reference in New Issue
Block a user