C# Class P2PStateServer.GetTransferMessage

Represents the GetTransferMessage message
The GetTransferMessage is broadcast to all connected peers when a peer wishes to receive a session resource from the network. The message is in turn forwarded to other peers that receive the message until tthe message traverses the network. If a peer receives this message and has the requested session resource, it proceeds to transfer the session resource to the peer that originated the broadcast. This message is only transmitted between peers.
Inheritance: PeerMessage
显示文件 Open project: tenor/p2pStateServer

Public Methods

Method Description
Broadcast ( string OriginHost, List sockets, StateServer Service, string SessionKey, System.Guid MessageID, int MaxForwards, System.Guid BroadcastID ) : void

Sends a GetTransferMessage to a list of ServiceSockets

Broadcast ( string OriginHost, List sockets, StateServer Service, string SessionKey, System.Guid MessageID, int MaxForwards, System.Guid BroadcastID, System.DateTime TimeoutStamp, Action FoundAction, System TimeoutAction ) : void

Sends a GetTransferMessage to a list of ServiceSockets and queues an Action to be called if the requested session is transferred to this peer, and another Action to be called if no session is transferred after a set time.

Equals ( object obj ) : bool
Forward ( ) : void

Forwards this message to other peers on the network

GetHashCode ( ) : int
GetTransferMessage ( HTTPPartialData Data, StateServer Service ) : System

Initializes a new instance of the GetTransferMessage class

Process ( ) : void

Process the message

Rebroadcast ( ) : void

Rebroadcasts this message across the network. Rebroadcasts are different from Forwards because they have a different broadcast id and are also sent to the originating peer

Private Methods

Method Description
CallExportEndedActions ( List Actions ) : void

Calls a list of Actions waiting to be processed after a session transfer is complete

CompleteTransferRequest ( ISessionObject Session, object StateObject ) : void

Called by the SessionDictionary.BeginExport method to complete processing the request, if the requested session was found and read

GetMergedHashCode ( System.Guid MessageID, System.Guid BroadcastID ) : int

Gets a hashcode value based on the combination of the message's ID and RebroadcastID

TransferFailure ( AsyncMessageTracker transferredMessage ) : void

Ends a failed Session Transfer

TransferSuccess ( AsyncMessageTracker transferredMessage ) : void

Ends a successful session transfer

Method Details

Broadcast() public static method

Sends a GetTransferMessage to a list of ServiceSockets
public static Broadcast ( string OriginHost, List sockets, StateServer Service, string SessionKey, System.Guid MessageID, int MaxForwards, System.Guid BroadcastID ) : void
OriginHost string The Host name of the peer that originally initiated this message
sockets List List of target ServiceSockets
Service StateServer Instance of state server
SessionKey string The requested session URI
MessageID System.Guid The unique message identifier
MaxForwards int The maximum number of nodes to forward the message to. This field is decremented by one for each forward
BroadcastID System.Guid The broadcast identifier. Used by peers to identify different broadcasts of the same message.
return void

Broadcast() public static method

Sends a GetTransferMessage to a list of ServiceSockets and queues an Action to be called if the requested session is transferred to this peer, and another Action to be called if no session is transferred after a set time.
public static Broadcast ( string OriginHost, List sockets, StateServer Service, string SessionKey, System.Guid MessageID, int MaxForwards, System.Guid BroadcastID, System.DateTime TimeoutStamp, Action FoundAction, System TimeoutAction ) : void
OriginHost string The Host name of the peer that originally initiated this message
sockets List List of target ServiceSockets
Service StateServer Instance of state server
SessionKey string The requested session URI
MessageID System.Guid The unique message identifier
MaxForwards int The maximum number of nodes to forward the message to. This field is decremented by one for each forward
BroadcastID System.Guid The broadcast identifier. Used by peers to identify different broadcasts of the same message
TimeoutStamp System.DateTime The Time in UTC, at which point the message query is considered timed out
FoundAction Action The Action to be called if the requested session is transferred to this peer
TimeoutAction System The Action to be called if the requested session is not transferred to this peer after the TimeoutStamp time
return void

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool

Forward() public method

Forwards this message to other peers on the network
public Forward ( ) : void
return void

GetHashCode() public method

public GetHashCode ( ) : int
return int

GetTransferMessage() public method

Initializes a new instance of the GetTransferMessage class
public GetTransferMessage ( HTTPPartialData Data, StateServer Service ) : System
Data HTTPPartialData The HTTPPartialData class to load this instance from
Service StateServer State server instance
return System

Process() public method

Process the message
public Process ( ) : void
return void

Rebroadcast() public method

Rebroadcasts this message across the network. Rebroadcasts are different from Forwards because they have a different broadcast id and are also sent to the originating peer
public Rebroadcast ( ) : void
return void