Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331968 - Socket::listen does not handle multiple addresses correctly
Summary: Socket::listen does not handle multiple addresses correctly
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: SCI (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Tu Hong Jun CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-06 19:00 EST by Greg Watson CLA
Modified: 2011-05-25 18:57 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Watson CLA 2010-12-06 19:00:29 EST
The code in Socket::listen iterates over each of the addresses returned by getaddrinfo and calls bind on each, regardless of whether the bind is successful or not. The subsequent call to listen is then only made on the socket for the last address. In situations where there are multiple addresses (e.g. IPv4 and IPv6), this code will leave sockets bound to ports that are never used, and because listen hasn't been called, in a half created state. The implementor should decide how to handle this situation correctly.
Comment 1 rong li CLA 2011-02-11 02:10:54 EST
For this issue, we have used an array to save the usable multiple addresses.
In each iteration, if the socket can be binded and listened successfully, we will save it into the array "accSockets[accCount] = sockfd;", and then do "accCount++;" to make sure the "accCount" records the correct number of usable socket. All the usable addresses can be used.
We have already committed the changes, pls try the latest version of SCI codes.
This issue should have been fixed.
Comment 2 Tu Hong Jun CLA 2011-02-11 03:31:39 EST
Yes, there was this problem but got fixed.
Comment 3 Greg Watson CLA 2011-05-25 18:57:33 EDT
Closing as fixed.