Skip to content

Commit b6c302d

Browse files
committed
fix: fixing hashcode and equals for endpoint
1 parent 42614d2 commit b6c302d

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Assets/MultiplexSocket/Runtime/ConnectionEndPoint.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,27 @@ public IEndPoint CreateCopy()
1818
socket = socket
1919
};
2020
}
21+
22+
public override bool Equals(object obj)
23+
{
24+
if (obj is ConnectionEndPoint other)
25+
{
26+
return socket.Equals(other.socket) && inner.Equals(other.inner);
27+
}
28+
return false;
29+
}
30+
31+
public override int GetHashCode()
32+
{
33+
int hash = 17;
34+
hash = hash * 23 + socket.GetHashCode();
35+
hash = hash * 23 + inner.GetHashCode();
36+
return hash;
37+
}
38+
39+
public override string ToString()
40+
{
41+
return $"Socket:{socket} EndPoint{inner}";
42+
}
2143
}
2244
}

0 commit comments

Comments
 (0)