C# Class Microsoft.HockeyApp.Channel.Sender

Fetch transmissions from the storage and sends it.
Inheritance: IDisposable
显示文件 Open project: bitstadium/HockeySDK-Windows

Protected Properties

Property Type Description
DelayHandler System.Threading.AutoResetEvent

Private Properties

Property Type Description
CalculateNextInterval System.TimeSpan
GetStatusCode int?
IsRetryable bool
LogInterval void
Sender System
StopAsync Task

Public Methods

Method Description
Dispose ( ) : void

Disposes the managed objects.

Protected Methods

Method Description
Send ( StorageTransmission transmission, System.TimeSpan &nextSendInterval ) : bool

Sends a transmission and handle errors.

SendLoop ( ) : void

Send transmissions in a loop.

Private Methods

Method Description
CalculateNextInterval ( int httpStatusCode, System.TimeSpan currentSendInterval, System.TimeSpan maxInterval ) : System.TimeSpan

Calculates the next interval using exponential back-off algorithm (with the exceptions of few error codes that reset the interval to SendingInterval.

GetStatusCode ( WebException e ) : int?

Return the status code from the web exception or null if no such code exists.

IsRetryable ( int httpStatusCode, WebExceptionStatus webExceptionStatus ) : bool

Returns true if httpStatusCode or webExceptionStatus are retriable.

LogInterval ( System.TimeSpan prevSendInterval, System.TimeSpan nextSendInterval ) : void

Log next interval. Only log the interval when it changes by more then a minute. So if interval grow by 1 minute or decreased by 1 minute it will be logged. Logging every interval will just make the log noisy.

Sender ( BaseStorageService storage, PersistenceTransmitter transmitter, bool startSending = true ) : System

Initializes a new instance of the Sender class.

StopAsync ( ) : Task

Stops the sender.

Method Details

Dispose() public method

Disposes the managed objects.
public Dispose ( ) : void
return void

Send() protected method

Sends a transmission and handle errors.
protected Send ( StorageTransmission transmission, System.TimeSpan &nextSendInterval ) : bool
transmission StorageTransmission The transmission to send.
nextSendInterval System.TimeSpan When this value returns it will hold a recommendation for when to start the next sending iteration.
return bool

SendLoop() protected method

Send transmissions in a loop.
protected SendLoop ( ) : void
return void

Property Details

DelayHandler protected_oe property

A wait handle that flags the sender when to start sending again. The type is protected for unit test.
protected AutoResetEvent,System.Threading DelayHandler
return System.Threading.AutoResetEvent