Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
bd6f84e5
Commit
bd6f84e5
authored
Dec 18, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set connect timeout.
parent
2545749d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
DDPClientCallback.java
.../main/java/chat/rocket/android_ddp/DDPClientCallback.java
+6
-0
DDPClientImpl.java
.../src/main/java/chat/rocket/android_ddp/DDPClientImpl.java
+3
-1
RocketChatWebSocketThread.java
...hat/rocket/android/service/RocketChatWebSocketThread.java
+6
-1
No files found.
android-ddp/src/main/java/chat/rocket/android_ddp/DDPClientCallback.java
View file @
bd6f84e5
...
...
@@ -36,6 +36,12 @@ public class DDPClientCallback {
this
.
version
=
version
;
}
}
public
static
class
Timeout
extends
BaseException
{
public
Timeout
(
DDPClient
client
)
{
super
(
client
);
}
}
}
public
static
class
Ping
extends
Base
{
...
...
android-ddp/src/main/java/chat/rocket/android_ddp/DDPClientImpl.java
View file @
bd6f84e5
...
...
@@ -67,6 +67,7 @@ public class DDPClientImpl {
observable
.
filter
(
callback
->
callback
instanceof
RxWebSocketCallback
.
Message
)
.
map
(
callback
->
((
RxWebSocketCallback
.
Message
)
callback
).
responseBodyString
)
.
map
(
DDPClientImpl:
:
toJson
)
.
timeout
(
7
,
TimeUnit
.
SECONDS
)
.
subscribe
(
response
->
{
String
msg
=
extractMsg
(
response
);
if
(
"connected"
.
equals
(
msg
)
&&
!
response
.
isNull
(
"session"
))
{
...
...
@@ -83,6 +84,7 @@ public class DDPClientImpl {
subscriptions
.
unsubscribe
();
}
},
err
->
{
task
.
setError
(
new
DDPClientCallback
.
Connect
.
Timeout
(
client
));
}));
addErrorCallback
(
subscriptions
,
task
);
...
...
@@ -336,7 +338,7 @@ public class DDPClientImpl {
private
void
addErrorCallback
(
CompositeSubscription
subscriptions
,
TaskCompletionSource
<?>
task
)
{
subscriptions
.
add
(
observable
.
subscribe
(
base
->
{
},
err
->
{
task
.
s
etError
(
new
Exception
(
err
));
task
.
tryS
etError
(
new
Exception
(
err
));
subscriptions
.
unsubscribe
();
}));
}
...
...
app/src/main/java/chat/rocket/android/service/RocketChatWebSocketThread.java
View file @
bd6f84e5
...
...
@@ -205,7 +205,12 @@ public class RocketChatWebSocketThread extends HandlerThread {
}
}).
continueWithTask
(
task
->
{
if
(
task
.
isFaulted
())
{
ServerConfig
.
logConnectionError
(
serverConfigId
,
task
.
getError
());
Exception
error
=
task
.
getError
();
if
(
error
instanceof
DDPClientCallback
.
Connect
.
Timeout
)
{
ServerConfig
.
logConnectionError
(
serverConfigId
,
new
Exception
(
"Connection Timeout"
));
}
else
{
ServerConfig
.
logConnectionError
(
serverConfigId
,
task
.
getError
());
}
}
return
task
;
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment