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
89f227ce
Commit
89f227ce
authored
May 15, 2018
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for issue #453
parent
6f929f58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
MQTTPacket.c
src/MQTTPacket.c
+10
-4
MQTTPacketOut.c
src/MQTTPacketOut.c
+2
-3
No files found.
src/MQTTPacket.c
View file @
89f227ce
/*******************************************************************************
* Copyright (c) 2009, 201
4
IBM Corp.
* Copyright (c) 2009, 201
8
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -14,6 +14,7 @@
* Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs, Allan Stockdill-Mander - SSL updates
* Ian Craggs - MQTT 3.1.1 support
* Ian Craggs - fix for issue 453
*******************************************************************************/
/**
...
...
@@ -179,27 +180,32 @@ int MQTTPacket_send(networkHandles* net, Header header, char* buffer, size_t buf
int
rc
;
size_t
buf0len
;
char
*
buf
;
int
count
=
0
;
FUNC_ENTRY
;
buf
=
malloc
(
10
);
buf
[
0
]
=
header
.
byte
;
buf0len
=
1
+
MQTTPacket_encode
(
&
buf
[
1
],
buflen
);
if
(
buffer
!=
NULL
)
count
=
1
;
#if !defined(NO_PERSISTENCE)
if
(
header
.
bits
.
type
==
PUBREL
)
{
char
*
ptraux
=
buffer
;
int
msgId
=
readInt
(
&
ptraux
);
rc
=
MQTTPersistence_put
(
net
->
socket
,
buf
,
buf0len
,
1
,
&
buffer
,
&
buflen
,
rc
=
MQTTPersistence_put
(
net
->
socket
,
buf
,
buf0len
,
count
,
&
buffer
,
&
buflen
,
header
.
bits
.
type
,
msgId
,
0
);
}
#endif
#if defined(OPENSSL)
if
(
net
->
ssl
)
rc
=
SSLSocket_putdatas
(
net
->
ssl
,
net
->
socket
,
buf
,
buf0len
,
1
,
&
buffer
,
&
buflen
,
&
freeData
);
rc
=
SSLSocket_putdatas
(
net
->
ssl
,
net
->
socket
,
buf
,
buf0len
,
count
,
&
buffer
,
&
buflen
,
&
freeData
);
else
#endif
rc
=
Socket_putdatas
(
net
->
socket
,
buf
,
buf0len
,
1
,
&
buffer
,
&
buflen
,
&
freeData
);
rc
=
Socket_putdatas
(
net
->
socket
,
buf
,
buf0len
,
count
,
&
buffer
,
&
buflen
,
&
freeData
);
if
(
rc
==
TCPSOCKET_COMPLETE
)
time
(
&
(
net
->
lastSent
));
...
...
src/MQTTPacketOut.c
View file @
89f227ce
/*******************************************************************************
* Copyright (c) 2009, 201
7
IBM Corp.
* Copyright (c) 2009, 201
8
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -142,12 +142,11 @@ int MQTTPacket_send_pingreq(networkHandles* net, const char* clientID)
{
Header
header
;
int
rc
=
0
;
size_t
buflen
=
0
;
FUNC_ENTRY
;
header
.
byte
=
0
;
header
.
bits
.
type
=
PINGREQ
;
rc
=
MQTTPacket_send
(
net
,
header
,
NULL
,
buflen
,
0
);
rc
=
MQTTPacket_send
(
net
,
header
,
NULL
,
0
,
0
);
Log
(
LOG_PROTOCOL
,
20
,
NULL
,
net
->
socket
,
clientID
,
rc
);
FUNC_EXIT_RC
(
rc
);
return
rc
;
...
...
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