Skip to content

Commit aa2f357

Browse files
committed
REF: Remove unused code from connector client
1 parent a84504d commit aa2f357

File tree

3 files changed

+35
-56
lines changed

3 files changed

+35
-56
lines changed

ClientLib/ConnectorClient.cs

Lines changed: 31 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,29 @@
1515
*/
1616

1717
using System;
18-
using System.Collections.Generic;
1918
using System.Threading;
20-
using System.Collections;
2119
using System.Collections.ObjectModel;
2220
using System.Text.RegularExpressions;
2321

2422
using Amqp;
2523

2624
namespace ClientLib
2725
{
26+
/// <summary>
27+
/// Connector client class
28+
/// </summary>
2829
public class ConnectorClient : CoreClient
2930
{
31+
/// <summary>
32+
/// Method for run connector
33+
/// </summary>
34+
/// <param name="args">cmd line arguments</param>
3035
public void Run(string[] args)
3136
{
32-
Collection<Connection> con_list = new Collection<Connection>();
33-
Collection<Session> ssn_list = new Collection<Session>();
34-
Collection<SenderLink> snd_list = new Collection<SenderLink>();
35-
Collection<ReceiverLink> rcv_list = new Collection<ReceiverLink>();
37+
Collection<Connection> connections = new Collection<Connection>();
38+
Collection<Session> sessions = new Collection<Session>();
39+
Collection<SenderLink> senders = new Collection<SenderLink>();
40+
Collection<ReceiverLink> receivers = new Collection<ReceiverLink>();
3641

3742
ConnectorOptions options = new ConnectorOptions();
3843

@@ -47,8 +52,7 @@ public void Run(string[] args)
4752

4853
for (int i = 0; i < options.MsgCount; i++)
4954
{
50-
Connection tmp_con = new Connection(new Address(options.Url));
51-
con_list.Add(tmp_con);
55+
connections.Add(new Connection(new Address(options.Url)));
5256
}
5357
}
5458

@@ -57,65 +61,45 @@ public void Run(string[] args)
5761
{
5862
try
5963
{
60-
foreach (Connection conn in con_list)
64+
foreach (Connection conn in connections)
6165
{
62-
//if connection is opened
63-
Session s = new Session(conn);
64-
ssn_list.Add(s);
65-
//if (options.syncMode == "action")
66-
//s.Sync();
67-
//else ssn_list.Add(null);
66+
sessions.Add(new Session(conn));
6867
}
6968
}
7069
catch (AmqpException ae)
7170
{
7271
Console.Error.WriteLine(ae.Message);
73-
for (int i = ssn_list.Count; i < con_list.Count; i++)
72+
for (int i = sessions.Count; i < connections.Count; i++)
7473
{
75-
ssn_list.Add(null);
74+
sessions.Add(null);
7675
Environment.Exit(ReturnCode.ERROR_OTHER);
7776
}
7877
}
7978

80-
// further object require non-empty address
81-
string address = "jms.queue.connection_tests";
82-
//address = options.Address ???
79+
string address = options.Address;
8380

84-
//not working currently
8581
if (address != String.Empty)
8682
{
87-
// sender part (if address is specified)
88-
// create senders for opened sessions
8983
if (Regex.IsMatch(options.ObjCtrl, "[S]"))
9084
{
9185
try
9286
{
9387
int i = 0;
94-
foreach (Session s in ssn_list)
88+
foreach (Session s in sessions)
9589
{
9690
i++;
9791
if (s != null)
98-
{
99-
SenderLink snd = new SenderLink(s, "tmp_s" + i.ToString(), address);
100-
snd_list.Add(snd);
101-
//TODO
102-
if (options.SyncMode == "action")
103-
{
104-
//s.Sync();
105-
}
106-
}
92+
senders.Add(new SenderLink(s, "sender" + i.ToString(), address));
10793
else
108-
{
109-
snd_list.Add(null);
110-
}
94+
senders.Add(null);
11195
}
11296
}
11397
catch (AmqpException ae)
11498
{
11599
Console.Error.WriteLine(ae.Message);
116-
for (int i = snd_list.Count; i < ssn_list.Count; i++)
100+
for (int i = senders.Count; i < sessions.Count; i++)
117101
{
118-
snd_list.Add(null);
102+
senders.Add(null);
119103
}
120104
Environment.Exit(ReturnCode.ERROR_OTHER);
121105
}
@@ -125,30 +109,21 @@ public void Run(string[] args)
125109
try
126110
{
127111
int i = 0;
128-
foreach (Session s in ssn_list)
112+
foreach (Session s in sessions)
129113
{
130114
i++;
131115
if (s != null)
132-
{
133-
ReceiverLink rcv = new ReceiverLink(s, "tmp_rcv" + i.ToString(), address);
134-
rcv_list.Add(rcv);
135-
if (options.SyncMode == "action")
136-
{
137-
//s.Sync();
138-
}
139-
}
116+
receivers.Add(new ReceiverLink(s, "tmp_rcv" + i.ToString(), address));
140117
else
141-
{
142-
rcv_list.Add(null);
143-
}
118+
receivers.Add(null);
144119
}
145120
}
146121
catch (AmqpException ae)
147122
{
148123
Console.Error.WriteLine(ae.Message);
149-
for (int i = rcv_list.Count; i < ssn_list.Count; i++)
124+
for (int i = receivers.Count; i < sessions.Count; i++)
150125
{
151-
rcv_list.Add(null);
126+
receivers.Add(null);
152127
}
153128
Environment.Exit(ReturnCode.ERROR_OTHER);
154129
}
@@ -170,28 +145,28 @@ public void Run(string[] args)
170145
if (options.CloseSleep > 0)
171146
Thread.Sleep(options.CloseSleep);
172147

173-
foreach (ReceiverLink rec in rcv_list)
148+
foreach (ReceiverLink rec in receivers)
174149
{
175150
if (rec != null)
176151
{
177152
rec.Close();
178153
}
179154
}
180-
foreach (SenderLink sen in snd_list)
155+
foreach (SenderLink sen in senders)
181156
{
182157
if (sen != null)
183158
{
184159
sen.Close();
185160
}
186161
}
187-
foreach (Session ses in ssn_list)
162+
foreach (Session ses in sessions)
188163
{
189164
if (ses != null)
190165
{
191166
ses.Close();
192167
}
193168
}
194-
foreach (Connection c in con_list)
169+
foreach (Connection c in connections)
195170
{
196171
if (c != null)
197172
{

ClientLib/OptionsParser.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public LinkOptions() : base()
105105
{
106106
//default values
107107
this.Settlement = SettlementMode.AtLeastOnce;
108+
this.Address = "examples";
108109

109110
//add options
110111
this.Add("link-at-most-once", "Sets 0-ack fire-and-forget delivery",

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# README #
2+
[![Build status](https://ci.appveyor.com/api/projects/status/6gdu7v5k09dgoosg/branch/master?svg=true)](https://ci.appveyor.com/project/dkornel/cli-netlite/branch/master)
3+
4+
25

36
### What is this repository for? ###
47

0 commit comments

Comments
 (0)