Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
paho.mqtt.c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
eclipse
paho.mqtt.c
Commits
ae855dd5
Commit
ae855dd5
authored
Apr 24, 2015
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Variable latency when sending/receiving messages
Bug: 465369
parent
b9946d43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
MQTTAsync.c
src/MQTTAsync.c
+14
-7
No files found.
src/MQTTAsync.c
View file @
ae855dd5
...
...
@@ -24,6 +24,7 @@
* Ian Craggs - fix for bug 442400: reconnecting after network cable unplugged
* Ian Craggs - fix for bug 444934 - incorrect free in freeCommand1
* Ian Craggs - fix for bug 445891 - assigning msgid is not thread safe
* Ian Craggs - fix for bug 465369 - longer latency than expected
*******************************************************************************/
/**
...
...
@@ -137,6 +138,11 @@ void MQTTAsync_init()
printf
(
"MQTTAsync: error %d initializing async_mutex
\n
"
,
rc
);
if
((
rc
=
pthread_mutex_init
(
mqttcommand_mutex
,
&
attr
))
!=
0
)
printf
(
"MQTTAsync: error %d initializing command_mutex
\n
"
,
rc
);
if
((
rc
=
pthread_cond_init
(
&
send_cond
->
cond
,
NULL
))
!=
0
)
printf
(
"MQTTAsync: error %d initializing send_cond cond
\n
"
,
rc
);
if
((
rc
=
pthread_mutex_init
(
&
send_cond
->
mutex
,
&
attr
))
!=
0
)
printf
(
"MQTTAsync: error %d initializing send_cond mutex
\n
"
,
rc
);
}
#define WINAPI
...
...
@@ -760,7 +766,9 @@ int MQTTAsync_addCommand(MQTTAsync_queuedCommand* command, int command_size)
}
MQTTAsync_unlock_mutex
(
mqttcommand_mutex
);
#if !defined(WIN32) && !defined(WIN64)
Thread_signal_cond
(
send_cond
);
rc
=
Thread_signal_cond
(
send_cond
);
if
(
rc
!=
0
)
Log
(
LOG_ERROR
,
0
,
"Error %d from signal cond"
,
rc
);
#else
if
(
!
Thread_check_sem
(
send_sem
))
Thread_post_sem
(
send_sem
);
...
...
@@ -927,7 +935,7 @@ void MQTTAsync_writeComplete(int socket)
}
void
MQTTAsync_processCommand
()
int
MQTTAsync_processCommand
()
{
int
rc
=
0
;
MQTTAsync_queuedCommand
*
command
=
NULL
;
...
...
@@ -1166,7 +1174,9 @@ void MQTTAsync_processCommand()
exit:
MQTTAsync_unlock_mutex
(
mqttasync_mutex
);
FUNC_EXIT
;
rc
=
(
command
!=
NULL
);
FUNC_EXIT_RC
(
rc
);
return
rc
;
}
...
...
@@ -1265,13 +1275,10 @@ thread_return_type WINAPI MQTTAsync_sendThread(void* n)
while
(
commands
->
count
>
0
)
{
int
before
=
commands
->
count
;
MQTTAsync_processCommand
();
if
(
before
==
commands
->
count
)
if
(
MQTTAsync_processCommand
()
==
0
)
break
;
/* no commands were processed, so go into a wait */
}
#if !defined(WIN32) && !defined(WIN64)
rc
=
Thread_wait_cond
(
send_cond
,
1
);
if
((
rc
=
Thread_wait_cond
(
send_cond
,
1
))
!=
0
&&
rc
!=
ETIMEDOUT
)
Log
(
LOG_ERROR
,
-
1
,
"Error %d waiting for condition variable"
,
rc
);
#else
...
...
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