This commit is contained in:
tonikelope 2017-12-02 17:36:01 +01:00
parent 4f9e6fe95e
commit b3224acedc
11 changed files with 208 additions and 245 deletions

View File

@ -0,0 +1 @@
6815744|olkSx9rnDOsIJ1GZNjihyg==

View File

@ -27,70 +27,31 @@ public class ChunkDownloaderMono extends ChunkDownloader {
public void run() {
String worker_url = null;
String current_proxy = null;
Chunk chunk;
int reads, conta_error, http_status = 200;
boolean error, error509;
boolean error;
HttpGet httpget = null;
CloseableHttpResponse httpresponse = null;
CloseableHttpClient httpclient = null;
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Worker [{1}]: let''s do some work!", new Object[]{Thread.currentThread().getName(), getId()});
try {
try (CloseableHttpClient httpclient = MiscTools.getApacheKissHttpClient()) {
conta_error = 0;
error = false;
error509 = false;
InputStream is = null;
while (!isExit() && !getDownload().isStopped()) {
if (this.getDownload().isUse_smart_proxy() && !this.getDownload().getMain_panel().isUse_smart_proxy()) {
this.getDownload().setUse_smart_proxy(false);
}
if (httpclient == null || worker_url == null || error || (this.getDownload().getMain_panel().isUse_smart_proxy() && this.getDownload().isUse_smart_proxy())) {
if (error509 && !this.getDownload().isUse_smart_proxy()) {
this.getDownload().setUse_smart_proxy(true);
}
if (this.getDownload().isUse_smart_proxy() && !MainPanel.isUse_proxy()) {
if (error && current_proxy != null) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, "{0} Worker mono: excluding proxy -> {1}", new Object[]{Thread.currentThread().getName(), current_proxy});
this.getDownload().getExcluded_proxies().add(current_proxy);
}
current_proxy = this.getDownload().getMain_panel().getProxy_manager().getRandomProxy(this.getDownload().getExcluded_proxies());
if (httpclient != null) {
try {
httpclient.close();
} catch (IOException ex) {
Logger.getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
}
}
httpclient = current_proxy != null ? MiscTools.getApacheKissHttpClientSmartProxy(current_proxy) : MiscTools.getApacheKissHttpClient();
} else if (httpclient == null) {
httpclient = MiscTools.getApacheKissHttpClient();
}
if (worker_url == null || error) {
worker_url = getDownload().getDownloadUrlForWorker();
if (httpresponse != null) {
httpresponse.close();
}
}
chunk = new Chunk(getDownload().nextChunkId(), getDownload().getFile_size(), null);
@ -116,10 +77,6 @@ public class ChunkDownloaderMono extends ChunkDownloader {
error = true;
if (http_status == 509) {
error509 = true;
}
getDownload().rejectChunkId(chunk.getId());
conta_error++;
@ -128,9 +85,7 @@ public class ChunkDownloaderMono extends ChunkDownloader {
setError_wait(true);
if (!this.getDownload().getMain_panel().isUse_smart_proxy()) {
Thread.sleep(getWaitTimeExpBackOff(conta_error) * 1000);
}
setError_wait(false);
}
@ -177,9 +132,7 @@ public class ChunkDownloaderMono extends ChunkDownloader {
setError_wait(true);
if (!this.getDownload().getMain_panel().isUse_smart_proxy()) {
Thread.sleep(getWaitTimeExpBackOff(conta_error) * 1000);
}
setError_wait(false);
}
@ -226,19 +179,10 @@ public class ChunkDownloaderMono extends ChunkDownloader {
getDownload().emergencyStopDownloader(ex.getMessage());
} catch (URISyntaxException | InterruptedException ex) {
} catch (URISyntaxException ex) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
} catch (Exception ex) {
Logger.getLogger(ChunkDownloaderMono.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if (httpclient != null) {
try {
httpclient.close();
} catch (IOException ex) {
Logger.getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
getDownload().stopThisSlot(this);

View File

@ -46,7 +46,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
public static final boolean VERIFY_CBC_MAC_DEFAULT = false;
public static final boolean USE_SLOTS_DEFAULT = false;
public static final int WORKERS_DEFAULT = 6;
public static final int WORKERS_DEFAULT = 8;
public static final boolean USE_MEGA_ACCOUNT_DOWN = false;
public static final int CHUNK_SIZE_MULTI = 10;
public static final int WATCHDOG_SMART_PROXY_TIMEOUT = 3600;

View File

@ -45,7 +45,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
*/
public final class MainPanel {
public static final String VERSION = "2.43";
public static final String VERSION = "2.44";
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
public static final int STREAMER_PORT = 1337;

View File

@ -124,6 +124,8 @@ public class MegaProxyServer extends Thread {
try {
String request = readLine(_clientSocket);
Logger.getLogger(getClass().getName()).log(Level.INFO, request);
Matcher matcher = CONNECT_PATTERN.matcher(request);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(_clientSocket.getOutputStream(), "UTF-8");
@ -144,6 +146,8 @@ public class MegaProxyServer extends Thread {
}
Logger.getLogger(getClass().getName()).log(Level.INFO, header);
} while (!"".equals(header));
if (proxy_auth != null && proxy_auth.equals("megacrypter:" + _password)) {

View File

@ -898,8 +898,6 @@ public final class MiscTools {
}
}
System.out.println(res);
return res.trim();
}

View File

@ -24,9 +24,10 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTabbedPane1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="status" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
@ -34,7 +35,6 @@
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="cancel_button" min="-2" pref="130" max="-2" attributes="0"/>
</Group>
<Component id="jTabbedPane1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -105,7 +105,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane2" pref="840" max="32767" attributes="0"/>
<Component id="jScrollPane2" pref="963" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@ -114,7 +114,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane2" pref="539" max="32767" attributes="0"/>
<Component id="jScrollPane2" pref="516" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@ -134,32 +134,18 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="change_download_dir_button" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="default_dir_label" max="32767" attributes="0"/>
</Group>
<Component id="jSeparator1" alignment="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jSeparator1" min="-2" pref="1009" max="-2" attributes="0"/>
<Component id="jSeparator2" min="-2" pref="1009" max="-2" attributes="0"/>
<Component id="jSeparator3" min="-2" pref="1009" max="-2" attributes="0"/>
<Component id="jSeparator4" alignment="0" max="32767" attributes="0"/>
<Component id="jSeparator7" alignment="0" max="32767" attributes="0"/>
<Component id="jSeparator8" alignment="0" max="32767" attributes="0"/>
<Component id="jSeparator2" alignment="0" max="32767" attributes="0"/>
<Component id="jSeparator3" alignment="0" max="32767" attributes="0"/>
<Component id="rec_download_slots_label" alignment="0" pref="1240" max="32767" attributes="0"/>
<Component id="jLabel2" alignment="1" max="32767" attributes="0"/>
<Component id="jSeparator10" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
<Component id="smart_proxy_url_label" min="-2" pref="42" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="smart_proxy_url_text" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSeparator10" alignment="0" max="32767" attributes="0"/>
<Component id="rec_download_slots_label" alignment="0" min="-2" pref="888" max="-2" attributes="0"/>
<Component id="megacrypter_reverse_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="down_dir_label" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="multi_slot_down_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
@ -202,11 +188,20 @@
</Group>
<Component id="megacrypter_reverse_warning_label" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="smart_proxy_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="change_download_dir_button" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="default_dir_label" max="32767" attributes="0"/>
</Group>
<Component id="jLabel2" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Component id="smart_proxy_url_label" min="-2" pref="42" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="smart_proxy_url_text" min="-2" pref="934" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -237,10 +232,10 @@
<Component id="default_slots_down_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="rec_download_slots_label" min="-2" max="-2" attributes="0"/>
<Component id="rec_download_slots_label" min="-2" pref="17" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator3" min="-2" pref="12" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator3" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Component id="limit_download_speed_checkbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@ -266,7 +261,7 @@
<Component id="megacrypter_reverse_checkbox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="megacrypter_reverse_port_spinner" alignment="3" min="-2" pref="24" max="-2" attributes="0"/>
<Component id="megacrypter_reverse_port_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="megacrypter_reverse_port_label" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
@ -282,7 +277,7 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="35" max="32767" attributes="0"/>
<EmptySpace pref="73" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -303,7 +298,7 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="2"/>
</Property>
<Property name="text" type="java.lang.String" value="Note: it is recommended not to enable MULTI SLOT (unless you want to download +5GB file without PRO account, in which case you will MUST USE multi slot). "/>
<Property name="text" type="java.lang.String" value="Note: if you want to download +5GB file with a FREE account you MUST enable MULTI SLOT. "/>
</Properties>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator3">
@ -520,7 +515,7 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="2"/>
</Property>
<Property name="text" type="java.lang.String" value="Note: it is recomended to enable MULTI SLOT and be patient while MegaBasterd filters down proxies. MegaBasterd will try first to download chunk without proxy."/>
<Property name="text" type="java.lang.String" value="Note: MULTI-SLOT REQUIRED. Be patient while MegaBasterd filters down proxies. MegaBasterd will try first to download chunk without proxy."/>
</Properties>
</Component>
</SubComponents>
@ -572,7 +567,7 @@
</Group>
<Component id="limit_upload_speed_checkbox" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="281" max="32767" attributes="0"/>
<EmptySpace min="0" pref="404" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@ -609,7 +604,7 @@
<Component id="max_up_speed_label" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="max_up_speed_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="343" max="32767" attributes="0"/>
<EmptySpace pref="320" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -765,7 +760,7 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="mega_accounts_scrollpane" pref="167" max="32767" attributes="0"/>
<Component id="mega_accounts_scrollpane" pref="153" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="remove_mega_account_button" alignment="3" min="-2" max="-2" attributes="0"/>
@ -774,7 +769,7 @@
<EmptySpace max="32767" attributes="0"/>
<Component id="elc_accounts_label" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="elc_accounts_scrollpane" pref="167" max="32767" attributes="0"/>
<Component id="elc_accounts_scrollpane" pref="153" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="remove_elc_account_button" alignment="3" min="-2" max="-2" attributes="0"/>
@ -984,7 +979,7 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="proxy_panel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="362" max="32767" attributes="0"/>
<EmptySpace pref="339" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -1135,11 +1130,11 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="proxy_user_label" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="proxy_user_textfield" pref="250" max="32767" attributes="0"/>
<Component id="proxy_user_textfield" pref="319" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="proxy_pass_label" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="proxy_pass_textfield" pref="283" max="32767" attributes="0"/>
<Component id="proxy_pass_textfield" pref="337" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>

View File

@ -443,6 +443,11 @@ public final class SettingsDialog extends javax.swing.JDialog {
swingReflectionInvoke("setEnabled", smart_proxy_url_text, true);
swingReflectionInvoke("setText", smart_proxy_url_text, smart_proxy_url);
if (!(Boolean) swingReflectionInvokeAndWaitForReturn("isSelected", multi_slot_down_checkbox)) {
swingReflectionInvoke("setSelected", multi_slot_down_checkbox, true);
}
} else {
swingReflectionInvoke("setSelected", smart_proxy_checkbox, false);
@ -598,7 +603,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
megacrypter_reverse_warning_label.setText("Note: you MUST \"OPEN\" this port in your router/firewall.");
rec_download_slots_label.setFont(new java.awt.Font("Dialog", 2, 14)); // NOI18N
rec_download_slots_label.setText("Note: it is recommended not to enable MULTI SLOT (unless you want to download +5GB file without PRO account, in which case you will MUST USE multi slot). ");
rec_download_slots_label.setText("Note: if you want to download +5GB file with a FREE account you MUST enable MULTI SLOT. ");
megacrypter_reverse_checkbox.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
megacrypter_reverse_checkbox.setText("Use Megacrypter reverse mode");
@ -697,7 +702,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
down_dir_label.setDoubleBuffered(true);
jLabel2.setFont(new java.awt.Font("Dialog", 2, 14)); // NOI18N
jLabel2.setText("Note: it is recomended to enable MULTI SLOT and be patient while MegaBasterd filters down proxies. MegaBasterd will try first to download chunk without proxy.");
jLabel2.setText("Note: MULTI-SLOT REQUIRED. Be patient while MegaBasterd filters down proxies. MegaBasterd will try first to download chunk without proxy.");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
@ -705,27 +710,15 @@ public final class SettingsDialog extends javax.swing.JDialog {
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(change_download_dir_button)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(default_dir_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jSeparator1)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 1009, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 1009, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 1009, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jSeparator4)
.addComponent(jSeparator7)
.addComponent(jSeparator8)
.addComponent(jSeparator2)
.addComponent(jSeparator3)
.addComponent(rec_download_slots_label, javax.swing.GroupLayout.DEFAULT_SIZE, 1240, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSeparator10, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(smart_proxy_url_label, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(smart_proxy_url_text))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator10)
.addComponent(rec_download_slots_label, javax.swing.GroupLayout.PREFERRED_SIZE, 888, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(megacrypter_reverse_checkbox)
.addComponent(down_dir_label)
.addComponent(multi_slot_down_checkbox)
@ -760,9 +753,18 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(megacrypter_reverse_port_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(megacrypter_reverse_warning_label)
.addComponent(smart_proxy_checkbox))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addComponent(smart_proxy_checkbox)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(change_download_dir_button)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(default_dir_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(smart_proxy_url_label, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(smart_proxy_url_text, javax.swing.GroupLayout.PREFERRED_SIZE, 934, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -788,10 +790,10 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addComponent(default_slots_down_label)
.addComponent(default_slots_down_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rec_download_slots_label)
.addComponent(rec_download_slots_label, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(4, 4, 4)
.addComponent(limit_download_speed_checkbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@ -815,7 +817,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addComponent(megacrypter_reverse_checkbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(megacrypter_reverse_port_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(megacrypter_reverse_port_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(megacrypter_reverse_port_label))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(megacrypter_reverse_warning_label, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -829,7 +831,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addComponent(smart_proxy_url_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addContainerGap(35, Short.MAX_VALUE))
.addContainerGap(73, Short.MAX_VALUE))
);
jScrollPane2.setViewportView(jPanel3);
@ -840,14 +842,14 @@ public final class SettingsDialog extends javax.swing.JDialog {
downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(downloads_panelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 840, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 963, Short.MAX_VALUE)
.addContainerGap())
);
downloads_panelLayout.setVerticalGroup(
downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(downloads_panelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 516, Short.MAX_VALUE)
.addContainerGap())
);
@ -924,7 +926,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(limit_upload_speed_checkbox))
.addGap(0, 281, Short.MAX_VALUE)))
.addGap(0, 404, Short.MAX_VALUE)))
.addContainerGap())))
);
uploads_panelLayout.setVerticalGroup(
@ -952,7 +954,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(max_up_speed_label)
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(343, Short.MAX_VALUE))
.addContainerGap(320, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Uploads", uploads_panel);
@ -1122,7 +1124,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mega_accounts_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)
.addComponent(mega_accounts_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(accounts_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(remove_mega_account_button)
@ -1130,7 +1132,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(elc_accounts_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(elc_accounts_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)
.addComponent(elc_accounts_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(accounts_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(remove_elc_account_button)
@ -1205,11 +1207,11 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addContainerGap()
.addComponent(proxy_user_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(proxy_user_textfield, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(proxy_user_textfield, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(proxy_pass_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(proxy_pass_textfield, javax.swing.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE))
.addComponent(proxy_pass_textfield, javax.swing.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE))
);
proxy_auth_panelLayout.setVerticalGroup(
proxy_auth_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -1279,7 +1281,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(proxy_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(362, Short.MAX_VALUE))
.addContainerGap(339, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Advanced", jPanel1);
@ -1294,13 +1296,13 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1)
.addGroup(layout.createSequentialGroup()
.addComponent(status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ok_button, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(cancel_button, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTabbedPane1))
.addComponent(cancel_button, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
@ -1680,7 +1682,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
private void multi_slot_down_checkboxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_multi_slot_down_checkboxStateChanged
if (!multi_slot_down_checkbox.isSelected()) {
if (!multi_slot_down_checkbox.isSelected() && !smart_proxy_checkbox.isSelected()) {
default_slots_down_spinner.setEnabled(false);
default_slots_down_label.setEnabled(false);
@ -1689,6 +1691,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
default_slots_down_spinner.setEnabled(true);
default_slots_down_label.setEnabled(true);
multi_slot_down_checkbox.setSelected(true);
}
}//GEN-LAST:event_multi_slot_down_checkboxStateChanged
@ -2228,6 +2231,13 @@ public final class SettingsDialog extends javax.swing.JDialog {
smart_proxy_url_label.setEnabled(true);
smart_proxy_url_text.setEnabled(true);
if (!multi_slot_down_checkbox.isSelected()) {
multi_slot_down_checkbox.setSelected(true);
}
} else {
smart_proxy_url_label.setEnabled(false);
smart_proxy_url_text.setEnabled(false);

View File

@ -10,7 +10,7 @@ public interface Transference {
int MIN_WORKERS = 2;
int MAX_WORKERS = 30;
int MAX_SIM_TRANSFERENCES = 20;
int MAX_SIM_TRANSFERENCES = 30;
int SIM_TRANSFERENCES_DEFAULT = 2;
boolean LIMIT_TRANSFERENCE_SPEED_DEFAULT = false;
int MAX_TRANSFERENCE_SPEED_DEFAULT = 5;

View File

@ -331,6 +331,32 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
public void run() {
while (true) {
if (!isRemoving_transferences() && !getTransference_remove_queue().isEmpty()) {
setRemoving_transferences(true);
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
if (!getTransference_remove_queue().isEmpty()) {
ArrayList<Transference> transferences = new ArrayList(getTransference_remove_queue());
getTransference_remove_queue().clear();
remove(transferences.toArray(new Transference[transferences.size()]));
}
setRemoving_transferences(false);
secureNotify();
}
});
}
if (!isPreprocessing_transferences() && !getTransference_preprocess_queue().isEmpty()) {
setPreprocessing_transferences(true);
@ -366,6 +392,11 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
@Override
public void run() {
while (isRemoving_transferences()) {
secureWait();
}
while (!getTransference_provision_queue().isEmpty()) {
Transference transference = getTransference_provision_queue().poll();
@ -385,31 +416,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
}
if (!isRemoving_transferences() && !getTransference_remove_queue().isEmpty()) {
setRemoving_transferences(true);
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
if (!getTransference_remove_queue().isEmpty()) {
ArrayList<Transference> transferences = new ArrayList(getTransference_remove_queue());
getTransference_remove_queue().clear();
remove(transferences.toArray(new Transference[transferences.size()]));
}
setRemoving_transferences(false);
secureNotify();
}
});
}
if (!isStarting_transferences() && !getTransference_waitstart_queue().isEmpty() && getTransference_running_list().size() < _max_running_trans) {
setStarting_transferences(true);
@ -417,6 +423,11 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
@Override
public void run() {
while (isRemoving_transferences()) {
secureWait();
}
while (!getTransference_waitstart_queue().isEmpty() && getTransference_running_list().size() < _max_running_trans) {
Transference transference = getTransference_waitstart_queue().poll();

View File

@ -25,7 +25,7 @@ import static megabasterd.MiscTools.*;
public final class Upload implements Transference, Runnable, SecureSingleThreadNotifiable {
public static final boolean USE_SLOTS_DEFAULT = false;
public static final int WORKERS_DEFAULT = 6;
public static final int WORKERS_DEFAULT = 8;
private final MainPanel _main_panel;
private volatile UploadView _view;
private volatile ProgressMeter _progress_meter;