Skip to content

Commit f3a8a54

Browse files
committed
Local peer name
1 parent 3fb8d88 commit f3a8a54

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

DataChannelOrtc.Mac/Main.storyboard

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@
809809
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
810810
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
811811
<tableColumns>
812-
<tableColumn identifier="" width="228" minWidth="40" maxWidth="1000" id="BbZ-Ls-tEU">
812+
<tableColumn identifier="" width="184" minWidth="40" maxWidth="1000" id="BbZ-Ls-tEU">
813813
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Author">
814814
<font key="font" metaFont="smallSystem"/>
815815
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -823,11 +823,11 @@
823823
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
824824
<prototypeCellViews>
825825
<tableCellView id="sM9-SX-2TM">
826-
<rect key="frame" x="1" y="1" width="228" height="17"/>
826+
<rect key="frame" x="1" y="1" width="184" height="17"/>
827827
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
828828
<subviews>
829829
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZEm-rh-VaQ">
830-
<rect key="frame" x="0.0" y="0.0" width="228" height="17"/>
830+
<rect key="frame" x="0.0" y="0.0" width="184" height="17"/>
831831
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
832832
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="izT-K8-KKX">
833833
<font key="font" metaFont="system"/>
@@ -842,7 +842,7 @@
842842
</tableCellView>
843843
</prototypeCellViews>
844844
</tableColumn>
845-
<tableColumn identifier="" width="254" minWidth="40" maxWidth="1000" id="Seg-yt-cbW">
845+
<tableColumn identifier="" width="298" minWidth="40" maxWidth="1000" id="Seg-yt-cbW">
846846
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Message">
847847
<font key="font" metaFont="smallSystem"/>
848848
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -856,11 +856,11 @@
856856
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
857857
<prototypeCellViews>
858858
<tableCellView id="00z-yy-WOh">
859-
<rect key="frame" x="232" y="1" width="254" height="17"/>
859+
<rect key="frame" x="188" y="1" width="298" height="17"/>
860860
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
861861
<subviews>
862862
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="m2w-qB-vII">
863-
<rect key="frame" x="0.0" y="0.0" width="254" height="17"/>
863+
<rect key="frame" x="0.0" y="0.0" width="298" height="17"/>
864864
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
865865
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="p0x-gj-qT5">
866866
<font key="font" metaFont="system"/>

DataChannelOrtc.Mac/Signaling/OrtcController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class OrtcController :
4141
static readonly Peer _localPeer = new Func<Peer>(() =>
4242
{
4343
string hostname = IPGlobalProperties.GetIPGlobalProperties().HostName;
44+
string peerHost = hostname != null ? hostname : "<unknown host>";
4445

4546
// A random string is added to the peer name to easily filter
4647
// our local peer by name when the server re-announces the
@@ -49,7 +50,7 @@ public class OrtcController :
4950
// causes a slightly different peer name on the peer list to
5051
// distinguish a new peer from an old zombie peer still not
5152
// yet purged from the server.
52-
string peerName = (hostname != null ? hostname : "<unknown host>") + "-" + _localPeerRandom + "-data";
53+
string peerName = peerHost + "-" + _localPeerRandom + "-data";
5354

5455
return new Peer(-1, peerName);
5556
})();

DataChannelOrtc.Mac/ViewController.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.ObjectModel;
33
using System.Diagnostics;
44
using System.Linq;
5-
using System.Net.NetworkInformation;
65
using System.Threading;
76
using System.Threading.Tasks;
87
using AppKit;
@@ -219,11 +218,10 @@ async partial void DisconnectButtonClicked(NSObject sender)
219218
partial void SendMessageButtonClicked(NSObject sender)
220219
{
221220
var messageText = MessageTextField.StringValue;
222-
string hostname = IPGlobalProperties.GetIPGlobalProperties().HostName;
223-
string peerName = hostname != null ? hostname : "<unknown host>";
221+
224222
if (messageText != string.Empty)
225223
{
226-
var message = new MacViewMessage(peerName, messageText);
224+
var message = new MacViewMessage(OrtcController.LocalPeer.Name, messageText);
227225
_messages.Add(message);
228226

229227
var DataSource = new ChatTableDataSource();

0 commit comments

Comments
 (0)