@@ -524,7 +524,8 @@ handleIncomingMessages node = go initConnectionState
524 . (incomingFrom theirAddr ^: Set.insert cid)
524 . (incomingFrom theirAddr ^: Set.insert cid)
527− else invalidRequest cid st ("unsupported reliability: "++show rel)
527+ else invalidRequest cid st $
528+ "attempt to connect with unsupported reliability " ++ show rel
528 NT.Received cid payload ->
529 NT.Received cid payload ->
529 case st ^. incomingAt cid of
530 case st ^. incomingAt cid of
530 Just (_, ToProc pid weakQueue) -> do
531 Just (_, ToProc pid weakQueue) -> do
@@ -557,7 +558,9 @@ handleIncomingMessages node = go initConnectionState
557 Just proc ->
558 Just proc ->
558 go (incomingAt cid ^= Just (src, ToProc pid (processWeakQ proc)) $ st)
559 go (incomingAt cid ^= Just (src, ToProc pid (processWeakQ proc)) $ st)
559 Nothing ->
560 Nothing ->
560− invalidRequest cid st "unknown local process id"
561+ invalidRequest cid st $
562+ "incoming attempt to connect to unknown process "
561 SendPortIdentifier chId -> do
564 SendPortIdentifier chId -> do
562 let lcid = sendPortLocalId chId
565 let lcid = sendPortLocalId chId
563 lpid = processLocalId (sendPortProcessId chId)
566 lpid = processLocalId (sendPortProcessId chId)
@@ -569,19 +572,28 @@ handleIncomingMessages node = go initConnectionState
569 Just channel ->
572 Just channel ->
570 go (incomingAt cid ^= Just (src, ToChan channel) $ st)
573 go (incomingAt cid ^= Just (src, ToChan channel) $ st)
571 Nothing ->
574 Nothing ->
572− invalidRequest cid st "unknown channel"
575+ invalidRequest cid st $
576+ "incoming attempt to connect to unknown channel of"
577+ ++ " process " ++ show (sendPortProcessId chId)
573 Nothing ->
578 Nothing ->
574− invalidRequest cid st "unknown process id"
579+ invalidRequest cid st $
580+ "incoming attempt to connect to channel of unknown"
581+ ++ " process " ++ show (sendPortProcessId chId)
575 NodeIdentifier nid ->
582 NodeIdentifier nid ->
576 if nid == localNodeId node
583 if nid == localNodeId node
577 then go (incomingAt cid ^= Just (src, ToNode) $ st)
584 then go (incomingAt cid ^= Just (src, ToNode) $ st)
578− else invalidRequest cid st "invalid node id"
585+ else invalidRequest cid st $
586+ "incoming attempt to connect to a different node -"
587+ ++ " I'm " ++ show (localNodeId node)
588+ ++ " but the remote peer wants to connect to "
579 Nothing ->
590 Nothing ->
580− invalidRequest cid st "invalid request target"
591+ invalidRequest cid st
592+ "message received from an unknown connection"
581 NT.ConnectionClosed cid ->
593 NT.ConnectionClosed cid ->
582 case st ^. incomingAt cid of
594 case st ^. incomingAt cid of
583 Nothing ->
595 Nothing ->
584− invalidRequest cid st "closed unknown connection id"
596+ invalidRequest cid st "closed unknown connection"
585 Just (src, _) -> do
597 Just (src, _) -> do
586 trace node (MxDisconnected cid src)
598 trace node (MxDisconnected cid src)
587 go ( (incomingAt cid ^= Nothing)
599 go ( (incomingAt cid ^= Nothing)
@@ -618,8 +630,10 @@ handleIncomingMessages node = go initConnectionState
618 -- node. That is, we should report the remote node as having died, and we
630 -- node. That is, we should report the remote node as having died, and we
619 -- should close incoming connections (this requires a Transport layer
631 -- should close incoming connections (this requires a Transport layer
620 -- extension).
632 -- extension).
621− traceEventFmtIO node "" [(TraceStr $ " [network] invalid request ("++msg++"): "),
633+ traceEventFmtIO node "" [ TraceStr $ " [network] invalid request"
634+ ++ " (" ++ msg ++ "): "
622− (Trace cid)]
635+ , (Trace cid)
623 go ( incomingAt cid ^= Nothing
637 go ( incomingAt cid ^= Nothing