Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
4c0c1b6a
Commit
4c0c1b6a
authored
Dec 28, 2017
by
Ghislain MARY
Browse files
Add timer to retry basic to client group chat room migration after some time if it has failed.
parent
88e381ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
src/chat/chat-room/basic-to-client-group-chat-room.cpp
src/chat/chat-room/basic-to-client-group-chat-room.cpp
+9
-0
tester/group_chat_tester.c
tester/group_chat_tester.c
+25
-4
tester/rcfiles/marie_rc
tester/rcfiles/marie_rc
+1
-0
No files found.
src/chat/chat-room/basic-to-client-group-chat-room.cpp
View file @
4c0c1b6a
...
...
@@ -48,12 +48,20 @@ public:
void
sendChatMessage
(
const
shared_ptr
<
ChatMessage
>
&
chatMessage
)
override
{
ProxyChatRoomPrivate
::
sendChatMessage
(
chatMessage
);
const
char
*
specs
=
linphone_core_get_linphone_specs
(
chatMessage
->
getCore
()
->
getCCore
());
time_t
currentRealTime
=
ms_time
(
nullptr
);
if
(
!
linphone_core_get_conference_factory_uri
(
chatMessage
->
getCore
()
->
getCCore
())
||
(
chatRoom
->
getCapabilities
()
&
ChatRoom
::
Capabilities
::
Conference
)
||
clientGroupChatRoom
||
!
specs
||
!
strstr
(
specs
,
"groupchat"
)
||
((
currentRealTime
-
migrationRealTime
)
<
linphone_config_get_int
(
linphone_core_get_config
(
chatMessage
->
getCore
()
->
getCCore
()),
"misc"
,
"basic_to_client_group_chat_room_migration_timer"
,
86400
)
// Try migration every 24 hours
)
)
{
return
;
}
migrationRealTime
=
currentRealTime
;
clientGroupChatRoom
=
static_pointer_cast
<
ClientGroupChatRoom
>
(
chatRoom
->
getCore
()
->
getPrivate
()
->
createClientGroupChatRoom
(
chatRoom
->
getSubject
(),
false
)
);
...
...
@@ -81,6 +89,7 @@ public:
private:
shared_ptr
<
ClientGroupChatRoom
>
clientGroupChatRoom
;
time_t
migrationRealTime
=
0
;
L_DECLARE_PUBLIC
(
BasicToClientGroupChatRoom
);
};
...
...
tester/group_chat_tester.c
View file @
4c0c1b6a
...
...
@@ -1757,14 +1757,14 @@ static void group_chat_room_migrate_from_basic_to_client_fail (void) {
BC_ASSERT_EQUAL
(
linphone_chat_room_get_capabilities
(
marieCr
),
LinphoneChatRoomCapabilitiesBasic
|
LinphoneChatRoomCapabilitiesProxy
|
LinphoneChatRoomCapabilitiesMigratable
,
int
,
"%d"
);
msg
=
linphone_chat_room_create_message
(
marieCr
,
"Did you migrate?"
);
linphone_chat_message_send
(
msg
);
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateCreationPending
,
initialMarieStats
.
number_of_LinphoneChatRoomStateCreationPending
+
1
,
10
000
));
BC_ASSERT_FALSE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateCreated
,
initialMarieStats
.
number_of_LinphoneChatRoomStateCreated
+
1
,
10
000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateCreationPending
,
initialMarieStats
.
number_of_LinphoneChatRoomStateCreationPending
+
1
,
3
000
));
BC_ASSERT_FALSE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateCreated
,
initialMarieStats
.
number_of_LinphoneChatRoomStateCreated
+
1
,
3
000
));
BC_ASSERT_TRUE
(
linphone_chat_room_get_capabilities
(
marieCr
)
&
LinphoneChatRoomCapabilitiesBasic
);
BC_ASSERT_EQUAL
(
linphone_chat_room_get_nb_participants
(
marieCr
),
1
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
linphone_chat_room_get_history_size
(
marieCr
),
2
,
int
,
"%d"
);
BC_ASSERT_FALSE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_LinphoneChatRoomStateCreationPending
,
initialPaulineStats
.
number_of_LinphoneChatRoomStateCreationPending
+
1
,
10
000
));
BC_ASSERT_FALSE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_LinphoneChatRoomStateCreated
,
initialPaulineStats
.
number_of_LinphoneChatRoomStateCreated
+
1
,
10
000
));
BC_ASSERT_FALSE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_LinphoneChatRoomStateCreationPending
,
initialPaulineStats
.
number_of_LinphoneChatRoomStateCreationPending
+
1
,
3
000
));
BC_ASSERT_FALSE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_LinphoneChatRoomStateCreated
,
initialPaulineStats
.
number_of_LinphoneChatRoomStateCreated
+
1
,
3
000
));
BC_ASSERT_TRUE
(
linphone_chat_room_get_capabilities
(
paulineCr
)
&
LinphoneChatRoomCapabilitiesBasic
);
BC_ASSERT_EQUAL
(
linphone_chat_room_get_nb_participants
(
paulineCr
),
1
,
int
,
"%d"
);
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_LinphoneMessageReceived
,
initialPaulineStats
.
number_of_LinphoneMessageReceived
+
1
,
1000
));
...
...
@@ -1781,6 +1781,27 @@ static void group_chat_room_migrate_from_basic_to_client_fail (void) {
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneMessageReceived
,
initialMarieStats
.
number_of_LinphoneMessageReceived
+
1
,
1000
));
BC_ASSERT_EQUAL
(
linphone_chat_room_get_history_size
(
marieCr
),
4
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
linphone_chat_room_get_history_size
(
paulineCr
),
4
,
int
,
"%d"
);
// Activate groupchat on Pauline's side and wait for 5 seconds, the migration should now be done on next message sending
linphone_core_set_linphone_specs
(
pauline
->
lc
,
"groupchat"
);
linphone_core_set_network_reachable
(
pauline
->
lc
,
FALSE
);
wait_for_list
(
coresList
,
&
dummy
,
1
,
1000
);
linphone_core_set_network_reachable
(
pauline
->
lc
,
TRUE
);
wait_for_list
(
coresList
,
&
dummy
,
1
,
5000
);
msg
=
linphone_chat_room_create_message
(
marieCr
,
"And now, did you migrate?"
);
linphone_chat_message_send
(
msg
);
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateCreationPending
,
initialMarieStats
.
number_of_LinphoneChatRoomStateCreationPending
+
2
,
10000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateCreated
,
initialMarieStats
.
number_of_LinphoneChatRoomStateCreated
+
1
,
10000
));
BC_ASSERT_TRUE
(
linphone_chat_room_get_capabilities
(
marieCr
)
&
LinphoneChatRoomCapabilitiesConference
);
BC_ASSERT_EQUAL
(
linphone_chat_room_get_nb_participants
(
marieCr
),
1
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
linphone_chat_room_get_history_size
(
marieCr
),
5
,
int
,
"%d"
);
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_LinphoneChatRoomStateCreationPending
,
initialPaulineStats
.
number_of_LinphoneChatRoomStateCreationPending
+
1
,
10000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_LinphoneChatRoomStateCreated
,
initialPaulineStats
.
number_of_LinphoneChatRoomStateCreated
+
1
,
10000
));
BC_ASSERT_TRUE
(
linphone_chat_room_get_capabilities
(
paulineCr
)
&
LinphoneChatRoomCapabilitiesConference
);
BC_ASSERT_EQUAL
(
linphone_chat_room_get_nb_participants
(
paulineCr
),
1
,
int
,
"%d"
);
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_LinphoneMessageReceived
,
initialPaulineStats
.
number_of_LinphoneMessageReceived
+
3
,
1000
));
BC_ASSERT_EQUAL
(
linphone_chat_room_get_history_size
(
paulineCr
),
5
,
int
,
"%d"
);
}
// Clean db from chat room
...
...
tester/rcfiles/marie_rc
View file @
4c0c1b6a
...
...
@@ -30,6 +30,7 @@ subscribe=0
[misc]
conference_factory_uri=sip:conference-factory@conf.example.org
enable_basic_to_client_group_chat_room_migration=1
basic_to_client_group_chat_room_migration_timer=10
[rtp]
audio_rtp_port=18070-28000
...
...
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