Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2010-05-06 18:42:03 -0400
committereutarass2010-05-06 18:42:03 -0400
commit0da141d414492543bf014e63528bc325300b57e8 (patch)
tree28b8993de0b0a3d1e6c6ef445cfbfe9cf72db4bc /plugins
parent044af5804c5b4d28036bb7a8f602dfe77c99f390 (diff)
downloadorg.eclipse.tcf-0da141d414492543bf014e63528bc325300b57e8.tar.gz
org.eclipse.tcf-0da141d414492543bf014e63528bc325300b57e8.tar.xz
org.eclipse.tcf-0da141d414492543bf014e63528bc325300b57e8.zip
TCF Core: minor performance improvement in discovery protocol implementation
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java
index 98c6d68bd..c61add16e 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java
@@ -568,14 +568,17 @@ public class LocatorService implements ILocator {
try {
out_buf[4] = CONF_PEER_INFO;
int i = 8;
+ StringBuffer sb = new StringBuffer(out_buf.length);
for (String key : attrs.keySet()) {
- String s = key + "=" + attrs.get(key);
- byte[] bt = s.getBytes("UTF-8");
- if (i + bt.length >= out_buf.length) break;
- System.arraycopy(bt, 0, out_buf, i, bt.length);
- i += bt.length;
- out_buf[i++] = 0;
- }
+ sb.append(key);
+ sb.append('=');
+ sb.append(attrs.get(key));
+ sb.append((char)0);
+ }
+ byte[] bt = sb.toString().getBytes("UTF-8");
+ if (i + bt.length > out_buf.length) return;
+ System.arraycopy(bt, 0, out_buf, i, bt.length);
+ i += bt.length;
for (SubNet subnet : subnets) {
if (peer instanceof RemotePeer) {

Back to the top