Passive 대상 제목에 (Passive) 표시, 연결됨 로그 중복 수정
- Passive 대상 PC 묶음 제목/서비스 앞 표시: "IP / hostname (Passive)" - 연결 상태 변경을 이벤트 시점 값으로 UI에 전달 (연속 변경 시 "연결됨"이 여러 번 기록되던 문제) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013U497kUNL8ArhV7jkzCpKamain
parent
39a8f03b59
commit
07c1b423a8
|
|
@ -95,10 +95,14 @@ namespace JJServiceManager
|
|||
{
|
||||
get
|
||||
{
|
||||
var addr = Direction == ConnectDirection.Passive
|
||||
? (string.IsNullOrWhiteSpace(LastAddress) ? "Passive " + AccessCode : LastAddress)
|
||||
: Address;
|
||||
return string.IsNullOrWhiteSpace(Hostname) ? addr : $"{addr} / {Hostname}";
|
||||
if (Direction == ConnectDirection.Passive)
|
||||
{
|
||||
// 아직 한 번도 접속하지 않았으면 코드로 표시
|
||||
if (string.IsNullOrWhiteSpace(LastAddress)) return "Passive " + AccessCode;
|
||||
var p = string.IsNullOrWhiteSpace(Hostname) ? LastAddress : $"{LastAddress} / {Hostname}";
|
||||
return p + " (Passive)";
|
||||
}
|
||||
return string.IsNullOrWhiteSpace(Hostname) ? Address : $"{Address} / {Hostname}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -794,7 +794,13 @@ namespace JJServiceManager
|
|||
StatusBrush = Brushes2.Pending,
|
||||
EmptyText = "연결 중…"
|
||||
};
|
||||
client.StateChanged += c => Dispatcher.BeginInvoke(new Action(() => OnRemoteState(g, c)));
|
||||
client.StateChanged += c =>
|
||||
{
|
||||
// 상태는 이벤트 시점 값으로 넘김 (UI에서 나중에 읽으면 연속 변경이 모두 같은 값으로 보임)
|
||||
var st = c.State;
|
||||
var stMsg = c.StateMessage;
|
||||
Dispatcher.BeginInvoke(new Action(() => OnRemoteState(g, st, stMsg)));
|
||||
};
|
||||
client.ServicesChanged += c => Dispatcher.BeginInvoke(new Action(() => OnRemoteServices(g, c)));
|
||||
client.HostnameDiscovered += (c, host) => Dispatcher.BeginInvoke(new Action(() => OnHostname(g, c, host)));
|
||||
client.PeerAddressDiscovered += (c, addr) => Dispatcher.BeginInvoke(new Action(() => OnPeerAddress(g, addr)));
|
||||
|
|
@ -851,10 +857,10 @@ namespace JJServiceManager
|
|||
_logWindows.ChoicesChanged();
|
||||
}
|
||||
|
||||
private void OnRemoteState(HostGroup g, RemoteClient c)
|
||||
private void OnRemoteState(HostGroup g, RemoteState state, string stateMessage)
|
||||
{
|
||||
if (!_groups.Contains(g)) return;
|
||||
switch (c.State)
|
||||
switch (state)
|
||||
{
|
||||
case RemoteState.Connected:
|
||||
g.StatusText = "연결됨";
|
||||
|
|
@ -868,17 +874,17 @@ namespace JJServiceManager
|
|||
break;
|
||||
default:
|
||||
bool wasConnected = g.Rows.Any(r => r.StatusKnown);
|
||||
g.StatusText = (c.State == RemoteState.AuthFailed ? "인증 실패: " : "연결 안 됨: ") + c.StateMessage;
|
||||
g.StatusText = (state == RemoteState.AuthFailed ? "인증 실패: " : "연결 안 됨: ") + stateMessage;
|
||||
g.StatusBrush = Brushes2.Stopped;
|
||||
g.EmptyText = g.StatusText;
|
||||
foreach (var r in g.Rows) r.MarkUnknown();
|
||||
// 같은 실패 메시지는 처음 한 번만 기록
|
||||
if (wasConnected || g.Tag != c.StateMessage)
|
||||
Log($"[{g.Prefix}] {g.StatusText}", c.State == RemoteState.AuthFailed ? LogLevel.Error : LogLevel.Warning);
|
||||
g.Tag = c.StateMessage;
|
||||
if (wasConnected || g.Tag != stateMessage)
|
||||
Log($"[{g.Prefix}] {g.StatusText}", state == RemoteState.AuthFailed ? LogLevel.Error : LogLevel.Warning);
|
||||
g.Tag = stateMessage;
|
||||
break;
|
||||
}
|
||||
if (c.State == RemoteState.Connected) g.Tag = null;
|
||||
if (state == RemoteState.Connected) g.Tag = null;
|
||||
UpdateCounts();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue