store connections as a set instead of map-of-remote-addresses

...since it is theoretically possible that the lifecycle events from
two consecutive inbound connections from the same remote address
overlap.
This commit is contained in:
Matthias Radestock committed 2015-09-30 17:29:13 +01:00
1 parent e68ca761a9
commit 0159e26631
2 files changed
+18 -17

No files matched your search

+2 -2
View File
@@ -165,12 +165,12 @@ func NewLocalConnectionStatusSlice(cm *ConnectionMaker) []LocalConnectionStatus
resultChan := make(chan []LocalConnectionStatus, 0)
cm.actionChan <- func() bool {
var slice []LocalConnectionStatus
for address, conn := range cm.connections {
for conn := range cm.connections {
state := "pending"
if conn.Established() {
state = "established"
}
slice = append(slice, LocalConnectionStatus{address, conn.Outbound(), state, conn.Remote().String()})
slice = append(slice, LocalConnectionStatus{conn.RemoteTCPAddr(), conn.Outbound(), state, conn.Remote().String()})
}
for address, target := range cm.targets {
var state, info string