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
8332e25b
Commit
8332e25b
authored
Apr 24, 2017
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for issue #186
parent
475992f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
Socket.c
src/Socket.c
+18
-7
No files found.
src/Socket.c
View file @
8332e25b
...
...
@@ -16,6 +16,7 @@
* Ian Craggs - fix for bug 484496
* Juergen Kosel, Ian Craggs - fix for issue #135
* Ian Craggs - issue #217
* Ian Craggs - fix for issue #186
*******************************************************************************/
/**
...
...
@@ -172,12 +173,22 @@ int Socket_addSocket(int newSd)
FUNC_ENTRY
;
if
(
ListFindItem
(
s
.
clientsds
,
&
newSd
,
intcompare
)
==
NULL
)
/* make sure we don't add the same socket twice */
{
int
*
pnewSd
=
(
int
*
)
malloc
(
sizeof
(
newSd
));
*
pnewSd
=
newSd
;
ListAppend
(
s
.
clientsds
,
pnewSd
,
sizeof
(
newSd
));
FD_SET
(
newSd
,
&
(
s
.
rset_saved
));
s
.
maxfdp1
=
max
(
s
.
maxfdp1
,
newSd
+
1
);
rc
=
Socket_setnonblocking
(
newSd
);
if
(
newSd
>=
FD_SETSIZE
)
{
Log
(
LOG_ERROR
,
-
1
,
"addSocket: exceeded FD_SETSIZE %d"
,
FD_SETSIZE
);
rc
=
SOCKET_ERROR
;
}
else
{
int
*
pnewSd
=
(
int
*
)
malloc
(
sizeof
(
newSd
));
*
pnewSd
=
newSd
;
ListAppend
(
s
.
clientsds
,
pnewSd
,
sizeof
(
newSd
));
FD_SET
(
newSd
,
&
(
s
.
rset_saved
));
s
.
maxfdp1
=
max
(
s
.
maxfdp1
,
newSd
+
1
);
rc
=
Socket_setnonblocking
(
newSd
);
if
(
rc
==
SOCKET_ERROR
)
Log
(
LOG_ERROR
,
-
1
,
"addSocket: setnonblocking"
);
}
}
else
Log
(
LOG_ERROR
,
-
1
,
"addSocket: socket %d already in the list"
,
newSd
);
...
...
@@ -671,7 +682,7 @@ int Socket_new(char* addr, int port, int* sock)
Log
(
TRACE_MIN
,
-
1
,
"New socket %d for %s, port %d"
,
*
sock
,
addr
,
port
);
if
(
Socket_addSocket
(
*
sock
)
==
SOCKET_ERROR
)
rc
=
Socket_error
(
"
setnonblocking
"
,
*
sock
);
rc
=
Socket_error
(
"
addSocket
"
,
*
sock
);
else
{
/* this could complete immmediately, even though we are non-blocking */
...
...
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