This repository has been archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started sub-threadding work on RPC calls.
- Loading branch information
Showing
8 changed files
with
176 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,28 @@ | ||
using System.Threading; | ||
using System; | ||
using System.Threading; | ||
|
||
namespace DtronixMessageQueue.Rpc { | ||
public class RpcReturnCallWait { | ||
public ushort Id { get; set; } | ||
|
||
/// <summary> | ||
/// Reset event used to hold the requesting | ||
/// </summary> | ||
public ManualResetEventSlim ReturnResetEvent { get; set; } | ||
|
||
/// <summary> | ||
/// Message that the other session receives from the connection that is associated with the return value for this request. | ||
/// </summary> | ||
public MqMessage ReturnMessage { get; set; } | ||
|
||
/// <summary> | ||
/// Cancellation token for the request. | ||
/// </summary> | ||
public CancellationToken Token { get; set; } | ||
|
||
/// <summary> | ||
/// Contains the time that this call wait was created to check for timeouts. | ||
/// </summary> | ||
public DateTime Created { get; } = DateTime.UtcNow; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System.Collections.Concurrent; | ||
using System.IO; | ||
|
||
namespace DtronixMessageQueue.Rpc { | ||
public class SerializationStore { | ||
private readonly MqSocketConfig config; | ||
|
||
public class Store { | ||
public MqMessageWriter MessageWriter; | ||
public MqMessageReader MessageReader; | ||
public MemoryStream Stream; | ||
} | ||
|
||
private readonly ConcurrentQueue<Store> reader_writers = new ConcurrentQueue<Store>(); | ||
|
||
public SerializationStore(MqSocketConfig config) { | ||
this.config = config; | ||
} | ||
|
||
public Store Get() { | ||
Store store; | ||
if (reader_writers.TryDequeue(out store) == false) { | ||
|
||
var mq_writer = new MqMessageWriter(config); | ||
var mq_reader = new MqMessageReader(); | ||
|
||
store = new Store { | ||
MessageWriter = mq_writer, | ||
MessageReader = mq_reader, | ||
Stream = new MemoryStream() | ||
|
||
}; | ||
} else { | ||
store.MessageWriter.Clear(); | ||
store.Stream.SetLength(0); | ||
} | ||
|
||
// | ||
|
||
|
||
return store; | ||
} | ||
|
||
public void Put(Store store) { | ||
reader_writers.Enqueue(store); | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters