public BufferedTransport(IEasyGelfLogger logger, ITransport transport) { new Thread(() => { var cancellationToken = cancellationTokenSource.Token; try { GelfMessage mesage; while (buffer.TryTake(out mesage, -1, cancellationToken)) { try { transport.Send(mesage); } catch(Exception exception) { logger.Error("Cannot send message", exception); } } } catch { GelfMessage message; while (buffer.TryTake(out message)) { try { transport.Send(message); } catch (Exception exception) { logger.Error("Cannot send message", exception); } } } transport.Close(); stopEvent.Set(); }) {IsBackground = true, Name = "EasyGelf Buffered Transport Thread"}.Start(); }
public void Close() { _clientTransport.Close(); _serverTransport.Close(); }
public void Close(bool suppressClosedEvent = true) { _wrappedTransport.Close(suppressClosedEvent); }
public void Close(bool suppressClosedEvent = true) { DefaultLogger.Debug("Closing test transport!"); _wrappedTransport.Close(suppressClosedEvent); }
public bool Disconnect() { return(transport.Close()); }
public void Close() { _transport.Close(); }
void IManager.OnTransportError(ITransport trans, string err) { (this as IManager).EmitError(SocketIOErrors.Internal, err); if (trans.State == TransportStates.Connecting || trans.State == TransportStates.Opening) { #if !BESTHTTP_DISABLE_WEBSOCKET if (trans is WebSocketTransport) { trans.Close(); // try to fall back Transport = new PollingTransport(this); Transport.Open(); } else // fallback failed #endif (this as IManager).TryToReconnect(); } else { trans.Close(); (this as IManager).TryToReconnect(); } }
public void Cleanup() { m_transport.Close(); m_heartbeatService.Stop(); }
/*private ITransport LoadTransportFromAssembly(string host, int port, String assemblyName, String transportType) * { * //Assembly assembly = Assembly.LoadFrom(assemblyName); * Assembly assembly = Assembly.Load(assemblyName); * * foreach (Type type in assembly.GetTypes()) * { * _log.Debug(String.Format("type = {0}", type)); * } * * Type transport = assembly.GetType(transportType); * * if (transport == null) * { * throw new ArgumentException( * String.Format("Type is not found in assembly. Type={0} Assembly={1}", transportType, assemblyName)); * * } * * _log.Debug("transport = " + transport); * _log.Debug("ctors = " + transport.GetConstructors()); * * ConstructorInfo info = transport.GetConstructors()[0]; * ITransport result = (ITransport)info.Invoke(new object[] { host, port, this }); * * _log.Debug("transport = " + result); * * return result; * }*/ public void Disconnect() { _transport.Close(); }