mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
TimeSpan as param
This commit is contained in:
parent
64440e4736
commit
1a7ffd4678
|
|
@ -31,7 +31,7 @@ namespace TLSharp.Core
|
||||||
private TimeSpan _requestTimeout;
|
private TimeSpan _requestTimeout;
|
||||||
|
|
||||||
public TelegramClient(int apiId, string apiHash,
|
public TelegramClient(int apiId, string apiHash,
|
||||||
ISessionStore store = null, string sessionUserId = "session", TcpClientConnectionHandler handler = null, double requestTimeout = 5d)
|
ISessionStore store = null, string sessionUserId = "session", TcpClientConnectionHandler handler = null, TimeSpan? requestTimeout = null)
|
||||||
{
|
{
|
||||||
if (apiId == default(int))
|
if (apiId == default(int))
|
||||||
throw new MissingApiConfigurationException("API_ID");
|
throw new MissingApiConfigurationException("API_ID");
|
||||||
|
|
@ -44,7 +44,7 @@ namespace TLSharp.Core
|
||||||
_apiHash = apiHash;
|
_apiHash = apiHash;
|
||||||
_apiId = apiId;
|
_apiId = apiId;
|
||||||
_handler = handler;
|
_handler = handler;
|
||||||
_requestTimeout = TimeSpan.FromSeconds(requestTimeout);
|
_requestTimeout = requestTimeout ?? TimeSpan.FromSeconds(5);
|
||||||
|
|
||||||
_session = Session.TryLoadOrCreateNew(store, sessionUserId);
|
_session = Session.TryLoadOrCreateNew(store, sessionUserId);
|
||||||
_transport = new TcpTransport(_session.DataCenter.Address, _session.DataCenter.Port, _handler);
|
_transport = new TcpTransport(_session.DataCenter.Address, _session.DataCenter.Port, _handler);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue