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
60a470cc
Commit
60a470cc
authored
Jul 07, 2014
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed some trace info to PROTOCOL to help with debugging
parent
62db601e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
MQTTClient.c
src/MQTTClient.c
+2
-2
MQTTProtocolClient.c
src/MQTTProtocolClient.c
+4
-4
Messages.c
src/Messages.c
+2
-1
Socket.c
src/Socket.c
+6
-6
No files found.
src/MQTTClient.c
View file @
60a470cc
...
@@ -886,7 +886,7 @@ int MQTTClient_connectURIVersion(MQTTClient handle, MQTTClient_connectOptions* o
...
@@ -886,7 +886,7 @@ int MQTTClient_connectURIVersion(MQTTClient handle, MQTTClient_connectOptions* o
else
else
{
{
Connack
*
connack
=
(
Connack
*
)
pack
;
Connack
*
connack
=
(
Connack
*
)
pack
;
Log
(
LOG
_PROTOCOL
,
1
,
NULL
,
m
->
c
->
net
.
socket
,
m
->
c
->
clientID
,
connack
->
rc
);
Log
(
TRACE
_PROTOCOL
,
1
,
NULL
,
m
->
c
->
net
.
socket
,
m
->
c
->
clientID
,
connack
->
rc
);
if
((
rc
=
connack
->
rc
)
==
MQTTCLIENT_SUCCESS
)
if
((
rc
=
connack
->
rc
)
==
MQTTCLIENT_SUCCESS
)
{
{
m
->
c
->
connected
=
1
;
m
->
c
->
connected
=
1
;
...
@@ -1632,7 +1632,7 @@ MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long
...
@@ -1632,7 +1632,7 @@ MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long
else
if
(
packet_type
==
UNSUBACK
)
else
if
(
packet_type
==
UNSUBACK
)
*
rc
=
Thread_wait_sem
(
m
->
unsuback_sem
,
timeout
);
*
rc
=
Thread_wait_sem
(
m
->
unsuback_sem
,
timeout
);
if
(
*
rc
==
0
&&
packet_type
!=
CONNECT
&&
m
->
pack
==
NULL
)
if
(
*
rc
==
0
&&
packet_type
!=
CONNECT
&&
m
->
pack
==
NULL
)
Log
(
TRACE_MIN
,
-
1
,
"waitfor unexpectedly is NULL for client %s, packet_type %d, timeout %ld"
,
m
->
c
->
clientID
,
packet_type
,
timeout
);
Log
(
LOG_ERROR
,
-
1
,
"waitfor unexpectedly is NULL for client %s, packet_type %d, timeout %ld"
,
m
->
c
->
clientID
,
packet_type
,
timeout
);
pack
=
m
->
pack
;
pack
=
m
->
pack
;
}
}
else
else
...
...
src/MQTTProtocolClient.c
View file @
60a470cc
...
@@ -522,7 +522,7 @@ void MQTTProtocol_keepalive(time_t now)
...
@@ -522,7 +522,7 @@ void MQTTProtocol_keepalive(time_t now)
{
{
if
(
MQTTPacket_send_pingreq
(
&
client
->
net
,
client
->
clientID
)
!=
TCPSOCKET_COMPLETE
)
if
(
MQTTPacket_send_pingreq
(
&
client
->
net
,
client
->
clientID
)
!=
TCPSOCKET_COMPLETE
)
{
{
Log
(
TRACE_
MIN
,
-
1
,
"Error sending PINGREQ for client %s on socket %d, disconnecting"
,
client
->
clientID
,
client
->
net
.
socket
);
Log
(
TRACE_
PROTOCOL
,
-
1
,
"Error sending PINGREQ for client %s on socket %d, disconnecting"
,
client
->
clientID
,
client
->
net
.
socket
);
MQTTProtocol_closeSession
(
client
,
1
);
MQTTProtocol_closeSession
(
client
,
1
);
}
}
else
else
...
@@ -534,7 +534,7 @@ void MQTTProtocol_keepalive(time_t now)
...
@@ -534,7 +534,7 @@ void MQTTProtocol_keepalive(time_t now)
}
}
else
else
{
{
Log
(
TRACE_
MIN
,
-
1
,
"PINGRESP not received in keepalive interval for client %s on socket %d, disconnecting"
,
client
->
clientID
,
client
->
net
.
socket
);
Log
(
TRACE_
PROTOCOL
,
-
1
,
"PINGRESP not received in keepalive interval for client %s on socket %d, disconnecting"
,
client
->
clientID
,
client
->
net
.
socket
);
MQTTProtocol_closeSession
(
client
,
1
);
MQTTProtocol_closeSession
(
client
,
1
);
}
}
}
}
...
@@ -578,7 +578,7 @@ void MQTTProtocol_retries(time_t now, Clients* client)
...
@@ -578,7 +578,7 @@ void MQTTProtocol_retries(time_t now, Clients* client)
if
(
rc
==
SOCKET_ERROR
)
if
(
rc
==
SOCKET_ERROR
)
{
{
client
->
good
=
0
;
client
->
good
=
0
;
Log
(
TRACE_
MIN
,
8
,
NULL
,
client
->
clientID
,
client
->
net
.
socket
,
Log
(
TRACE_
PROTOCOL
,
29
,
NULL
,
client
->
clientID
,
client
->
net
.
socket
,
Socket_getpeer
(
client
->
net
.
socket
));
Socket_getpeer
(
client
->
net
.
socket
));
MQTTProtocol_closeSession
(
client
,
1
);
MQTTProtocol_closeSession
(
client
,
1
);
client
=
NULL
;
client
=
NULL
;
...
@@ -596,7 +596,7 @@ void MQTTProtocol_retries(time_t now, Clients* client)
...
@@ -596,7 +596,7 @@ void MQTTProtocol_retries(time_t now, Clients* client)
if
(
MQTTPacket_send_pubrel
(
m
->
msgid
,
1
,
&
client
->
net
,
client
->
clientID
)
!=
TCPSOCKET_COMPLETE
)
if
(
MQTTPacket_send_pubrel
(
m
->
msgid
,
1
,
&
client
->
net
,
client
->
clientID
)
!=
TCPSOCKET_COMPLETE
)
{
{
client
->
good
=
0
;
client
->
good
=
0
;
Log
(
TRACE_
MIN
,
8
,
NULL
,
client
->
clientID
,
client
->
net
.
socket
,
Log
(
TRACE_
PROTOCOL
,
29
,
NULL
,
client
->
clientID
,
client
->
net
.
socket
,
Socket_getpeer
(
client
->
net
.
socket
));
Socket_getpeer
(
client
->
net
.
socket
));
MQTTProtocol_closeSession
(
client
,
1
);
MQTTProtocol_closeSession
(
client
,
1
);
client
=
NULL
;
client
=
NULL
;
...
...
src/Messages.c
View file @
60a470cc
...
@@ -66,6 +66,7 @@ static char* protocol_message_list[] =
...
@@ -66,6 +66,7 @@ static char* protocol_message_list[] =
"%d %s <- CONNECT"
,
/* 26 */
"%d %s <- CONNECT"
,
/* 26 */
"%d %s -> PUBLISH qos: 0 retained: %d (%d)"
,
/* 27 */
"%d %s -> PUBLISH qos: 0 retained: %d (%d)"
,
/* 27 */
"%d %s -> DISCONNECT (%d)"
,
/* 28 */
"%d %s -> DISCONNECT (%d)"
,
/* 28 */
"Socket error for client identifier %s, socket %d, peer address %s; ending connection"
,
/* 29 */
};
};
static
char
*
trace_message_list
[]
=
static
char
*
trace_message_list
[]
=
...
@@ -78,7 +79,7 @@ static char* trace_message_list[] =
...
@@ -78,7 +79,7 @@ static char* trace_message_list[] =
"Packet %s received from client %s for message identifier %d, but message is in wrong state"
,
/* 5 */
"Packet %s received from client %s for message identifier %d, but message is in wrong state"
,
/* 5 */
"%s received from client %s for message id %d - removing publication"
,
/* 6 */
"%s received from client %s for message id %d - removing publication"
,
/* 6 */
"Trying %s again for client %s, socket %d, message identifier %d"
,
/* 7 */
"Trying %s again for client %s, socket %d, message identifier %d"
,
/* 7 */
"
Socket error for client identifier %s, socket %d, peer address %s; ending connection
"
,
/* 8 */
""
,
/* 8 */
"(%lu) %*s(%d)> %s:%d"
,
/* 9 */
"(%lu) %*s(%d)> %s:%d"
,
/* 9 */
"(%lu) %*s(%d)< %s:%d"
,
/* 10 */
"(%lu) %*s(%d)< %s:%d"
,
/* 10 */
"(%lu) %*s(%d)< %s:%d (%d)"
,
/* 11 */
"(%lu) %*s(%d)< %s:%d (%d)"
,
/* 11 */
...
...
src/Socket.c
View file @
60a470cc
...
@@ -98,7 +98,7 @@ int Socket_error(char* aString, int sock)
...
@@ -98,7 +98,7 @@ int Socket_error(char* aString, int sock)
if
(
errno
!=
EINTR
&&
errno
!=
EAGAIN
&&
errno
!=
EINPROGRESS
&&
errno
!=
EWOULDBLOCK
)
if
(
errno
!=
EINTR
&&
errno
!=
EAGAIN
&&
errno
!=
EINPROGRESS
&&
errno
!=
EWOULDBLOCK
)
{
{
if
(
strcmp
(
aString
,
"shutdown"
)
!=
0
||
(
errno
!=
ENOTCONN
&&
errno
!=
ECONNRESET
))
if
(
strcmp
(
aString
,
"shutdown"
)
!=
0
||
(
errno
!=
ENOTCONN
&&
errno
!=
ECONNRESET
))
Log
(
TRACE_MIN
,
-
1
,
"Socket error %s in %s for socket %d"
,
strerror
(
errno
),
aString
,
sock
);
Log
(
LOG_ERROR
,
-
1
,
"Socket error %s in %s for socket %d"
,
strerror
(
errno
),
aString
,
sock
);
}
}
FUNC_EXIT_RC
(
errno
);
FUNC_EXIT_RC
(
errno
);
return
errno
;
return
errno
;
...
@@ -170,7 +170,7 @@ int Socket_addSocket(int newSd)
...
@@ -170,7 +170,7 @@ int Socket_addSocket(int newSd)
rc
=
Socket_setnonblocking
(
newSd
);
rc
=
Socket_setnonblocking
(
newSd
);
}
}
else
else
Log
(
TRACE_MIN
,
-
1
,
"addSocket: socket %d already in the list"
,
newSd
);
Log
(
LOG_ERROR
,
-
1
,
"addSocket: socket %d already in the list"
,
newSd
);
FUNC_EXIT_RC
(
rc
);
FUNC_EXIT_RC
(
rc
);
return
rc
;
return
rc
;
...
@@ -640,10 +640,10 @@ int Socket_new(char* addr, int port, int* sock)
...
@@ -640,10 +640,10 @@ int Socket_new(char* addr, int port, int* sock)
else
else
rc
=
-
1
;
rc
=
-
1
;
freeaddrinfo
(
result
);
freeaddrinfo
(
result
);
}
}
else
else
Log
(
TRACE_MIN
,
-
1
,
"getaddrinfo failed for addr %s with rc %d"
,
addr
,
rc
);
Log
(
LOG_ERROR
,
-
1
,
"getaddrinfo failed for addr %s with rc %d"
,
addr
,
rc
);
if
(
rc
!=
0
)
if
(
rc
!=
0
)
Log
(
LOG_ERROR
,
-
1
,
"%s is not a valid IP address"
,
addr
);
Log
(
LOG_ERROR
,
-
1
,
"%s is not a valid IP address"
,
addr
);
...
@@ -658,7 +658,7 @@ int Socket_new(char* addr, int port, int* sock)
...
@@ -658,7 +658,7 @@ int Socket_new(char* addr, int port, int* sock)
int
opt
=
1
;
int
opt
=
1
;
if
(
setsockopt
(
*
sock
,
SOL_SOCKET
,
SO_NOSIGPIPE
,
(
void
*
)
&
opt
,
sizeof
(
opt
))
!=
0
)
if
(
setsockopt
(
*
sock
,
SOL_SOCKET
,
SO_NOSIGPIPE
,
(
void
*
)
&
opt
,
sizeof
(
opt
))
!=
0
)
Log
(
TRACE_MIN
,
-
1
,
"Could not set SO_NOSIGPIPE for socket %d"
,
*
sock
);
Log
(
LOG_ERROR
,
-
1
,
"Could not set SO_NOSIGPIPE for socket %d"
,
*
sock
);
#endif
#endif
Log
(
TRACE_MIN
,
-
1
,
"New socket %d for %s, port %d"
,
*
sock
,
addr
,
port
);
Log
(
TRACE_MIN
,
-
1
,
"New socket %d for %s, port %d"
,
*
sock
,
addr
,
port
);
...
...
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