public ErlConnection Connection(ErlAtom toNode, ErlAtom?cookie = null) { ErlConnection c; if (m_Connections.TryGetValue(toNode, out c)) { return(c); } var peer = new ErlRemoteNode(this, toNode, cookie); //try to append config to remote node TryAppendConfigToRemoteNode(peer); lock (m_Connections) { if (m_Connections.TryGetValue(toNode, out c)) { return(c); } try { c = new ErlConnection(this, peer, true); } catch { return(null); } m_Connections.TryAdd(toNode, c); return(c); } }
internal void UnhandledMsg(ErlConnection conn, ErlMsg msg) { if (m_OnUnhandledMsg != null) { m_OnUnhandledMsg(conn, msg); } }
internal ErlConnection Connection(string toNode, IConfigSectionNode config, ErlAtom?cookie = null) { var peer = new ErlRemoteNode(this, toNode); // This will convert toNode to a valid ErlAtom lock (m_Connections) { ErlConnection c; if (m_Connections.TryGetValue(peer.NodeName, out c)) { return(c); } peer.Configure(config); // Fetch all proper TCP and other settings try { c = new ErlConnection(this, peer, true); } catch { return(null); } // TODO: maybe add return reason for connection failure? m_Connections.TryAdd(peer.NodeName, c); return(c); } }
/// <summary> /// Add a connection to collection /// </summary> /// <returns>Returns false if this connection was already previously added</returns> public bool Add(ErlConnection conn) { var res = m_Connections.TryAdd(conn.Name, conn); if (res) { OnNodeStatusChange(conn.Name, true, null); } return(res); }
protected internal virtual void OnUnhandledMsg(ErlConnection conn, ErlMsg msg, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { if (UnhandledMsg != null) { UnhandledMsg(this, conn, msg); } if (LogUnhandledMsgs) { Log(MessageType.TraceErl, "OnUnhandledMsg", "Connection {0} couldn't find mbox for: {1}".Args(conn.Name, msg), file: file, line: line); } }
protected internal virtual void OnUnhandledMsg(ErlConnection conn, ErlMsg msg) { if (UnhandledMsg != null) { UnhandledMsg(this, conn, msg); } if (LogUnhandledMsgs) { App.Log.Write(new NFX.Log.Message { Type = Log.MessageType.TraceErl, Topic = CoreConsts.ERLANG_TOPIC, From = this.ToString(), Text = "Connection {0} couldn't find mbox for: {1}".Args(conn.Name, msg) }); } }
/// <summary> /// Remove a connection from collection /// </summary> public void Remove(ErlConnection conn) { ErlConnection value; m_Connections.TryRemove(conn.Name, out value); }
internal void UnhandledMsg(ErlConnection conn, ErlMsg msg) { if (m_OnUnhandledMsg != null) m_OnUnhandledMsg(conn, msg); }
/// <summary> /// Add a connection to collection /// </summary> /// <returns>Returns false if this connection was already previously added</returns> public bool Add(ErlConnection conn) { var res = m_Connections.TryAdd(conn.Name, conn); if (res) NodeStatus(conn.Name, true, null); return res; }
public ErlConnection Connection(ErlAtom toNode, ErlAtom? cookie = null) { ErlConnection c; if (m_Connections.TryGetValue(toNode, out c)) return c; var peer = new ErlRemoteNode(this, toNode, cookie); lock (m_Connections) { if (m_Connections.TryGetValue(toNode, out c)) return c; try { c = new ErlConnection(this, peer, true); } catch { return null; } m_Connections.TryAdd(toNode, c); return c; } }
internal ErlConnection Connection(string toNode, IConfigSectionNode config) { var peer = new ErlRemoteNode(this, toNode); // This will convert toNode to a valid ErlAtom lock (m_Connections) { ErlConnection c; if (m_Connections.TryGetValue(peer.NodeName, out c)) return c; peer.Configure(config); // Fetch all proper TCP and other settings try { c = new ErlConnection(this, peer, true); } catch { return null; } m_Connections.TryAdd(peer.NodeName, c); return c; } }
protected internal virtual void OnUnhandledMsg(ErlConnection conn, ErlMsg msg, [CallerFilePath] string file = null, [CallerLineNumber]int line = 0) { if (UnhandledMsg != null) UnhandledMsg(this, conn, msg); if (LogUnhandledMsgs) App.Log.Write(new NFX.Log.Message(null, file, line) { Type = Log.MessageType.TraceErl, Topic = CoreConsts.ERLANG_TOPIC, From = this.ToString(), Text = "Connection {0} couldn't find mbox for: {1}".Args(conn.Name, msg) }); }
protected internal virtual void OnUnhandledMsg(ErlConnection conn, ErlMsg msg, [CallerFilePath]string file = "", [CallerLineNumber]int line = 0) { if (UnhandledMsg != null) UnhandledMsg(this, conn, msg); if (LogUnhandledMsgs) Log(MessageType.TraceErl, "OnUnhandledMsg", "Connection {0} couldn't find mbox for: {1}".Args(conn.Name, msg), file:file, line:line); }