ziga-commits Mailing List for Ziga
Status: Beta
Brought to you by:
tristian
You can subscribe to this list here.
| 2002 |
Jan
(6) |
Feb
(102) |
Mar
(64) |
Apr
(176) |
May
(2) |
Jun
(14) |
Jul
(111) |
Aug
(12) |
Sep
(106) |
Oct
(47) |
Nov
(5) |
Dec
(54) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(68) |
Feb
(49) |
Mar
(10) |
Apr
(1) |
May
(62) |
Jun
(50) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: dorothy c. <do...@sb...> - 2006-04-14 16:45:26
|
I received a ZIGA Digital Picture Frame with MP3 player for Christmas. The frame has quite responding to all commands except the on/off command and will not display the photos that are on the memory card that is plugged into it. It has not been dropped, and has not been damaged to my knowledge. It displayed photographs and they rotated as they were supposed to do until about one week ago. Can you help me? Dorothy Coston Ashley |
|
From: Frederik Z. <tri...@us...> - 2003-06-26 13:09:31
|
Update of /cvsroot/ziga/src/ziga/opennap/transfer In directory sc8-pr-cvs1:/tmp/cvs-serv8107/ziga/opennap/transfer Modified Files: DownloadManager.java Log Message: forgot to register TransferStatusChangeListener at download Index: DownloadManager.java =================================================================== RCS file: /cvsroot/ziga/src/ziga/opennap/transfer/DownloadManager.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** DownloadManager.java 7 Jun 2003 11:31:39 -0000 1.35 --- DownloadManager.java 26 Jun 2003 13:09:27 -0000 1.36 *************** *** 547,550 **** --- 547,551 ---- DefaultManagedDownload download = new DefaultManagedDownload(transferManager, this, dc); + download.addTransferStatusChangeListener(this); download.setForcedDownload(true); transferManager.occupyDownloadSlot(download); |
|
From: Frederik Z. <tri...@us...> - 2003-06-26 11:06:28
|
Update of /cvsroot/ziga/src/ziga/opennap/connection
In directory sc8-pr-cvs1:/tmp/cvs-serv23593/ziga/opennap/connection
Modified Files:
OpennapConnectionHandler.java
Log Message:
Index: OpennapConnectionHandler.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/connection/OpennapConnectionHandler.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** OpennapConnectionHandler.java 7 Jun 2003 11:26:13 -0000 1.24
--- OpennapConnectionHandler.java 26 Jun 2003 11:06:24 -0000 1.25
***************
*** 140,144 ****
}
! public void setStatus(Status status) {
synchronized (statusChangeLock) {
if (alive) {
--- 140,144 ----
}
! protected void setStatus(Status status) {
synchronized (statusChangeLock) {
if (alive) {
***************
*** 148,152 ****
}
! public void error(Exception e) {
if (ziga.Debug.isDebugEnabled()) {
ziga.Debug.finer(getClass().getName(), "error", toString(), e);
--- 148,152 ----
}
! protected void error(Exception e) {
if (ziga.Debug.isDebugEnabled()) {
ziga.Debug.finer(getClass().getName(), "error", toString(), e);
***************
*** 163,166 ****
--- 163,167 ----
if (status != Status.LOGGED_IN) {
server.loginFailed();
+ increaseConnectionAttempts(server);
}
setStatus(errorStatus);
***************
*** 185,190 ****
if (!status.isDisconnected()) {
setStatus(Status.DISCONNECTED_BY_USER);
- } else {
- increaseConnectionAttempts(server);
}
}
--- 186,189 ----
***************
*** 229,233 ****
conManager.getServersInNetwork(server.getNetwork());
! if (serversInNetwork == null) {
Iterator itr = serversInNetwork.iterator();
while (itr.hasNext()) {
--- 228,232 ----
conManager.getServersInNetwork(server.getNetwork());
! if (serversInNetwork != null) {
Iterator itr = serversInNetwork.iterator();
while (itr.hasNext()) {
***************
*** 242,249 ****
}
}
server.loginFailed();
increaseConnectionAttempts(server);
- } else {
- server.loggedIn();
}
--- 241,248 ----
}
}
+ server.loggedIn();
+ } else {
server.loginFailed();
increaseConnectionAttempts(server);
}
***************
*** 764,768 ****
|| numberOfFiles != numOfFiles
|| totalFileSize != librarySize) {
! users = numberOfUsers;
numOfFiles = numberOfFiles;
librarySize = totalFileSize;
--- 763,767 ----
|| numberOfFiles != numOfFiles
|| totalFileSize != librarySize) {
! users = numberOfUsers;
numOfFiles = numberOfFiles;
librarySize = totalFileSize;
|
|
From: Frederik Z. <tri...@us...> - 2003-06-15 10:22:52
|
Update of /cvsroot/ziga/src/ziga/opennap/connection
In directory sc8-pr-cvs1:/tmp/cvs-serv7760/ziga/opennap/connection
Modified Files:
DefaultOpennapConnectionManager.java
Log Message:
Index: DefaultOpennapConnectionManager.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/connection/DefaultOpennapConnectionManager.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** DefaultOpennapConnectionManager.java 7 Jun 2003 11:26:59 -0000 1.33
--- DefaultOpennapConnectionManager.java 15 Jun 2003 10:22:49 -0000 1.34
***************
*** 947,951 ****
}
! if (makeConnection(server, forceConnection)) {
return true;
}
--- 947,951 ----
}
! if (server != null && makeConnection(server, forceConnection)) {
return true;
}
|
|
From: Frederik Z. <tri...@us...> - 2003-06-11 22:46:32
|
Update of /cvsroot/ziga/src/ziga/transfer
In directory sc8-pr-cvs1:/tmp/cvs-serv30573/ziga/transfer
Modified Files:
StatusRemoteQueued.java StatusQueued.java
Log Message:
forgot to implement Comparable
Index: StatusRemoteQueued.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/transfer/StatusRemoteQueued.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** StatusRemoteQueued.java 16 May 2003 13:01:34 -0000 1.1
--- StatusRemoteQueued.java 11 Jun 2003 22:46:26 -0000 1.2
***************
*** 27,31 ****
* @author Frederik Zimmer
*/
! public class StatusRemoteQueued extends Status {
private Integer queuePosition;
private Integer queueLength;
--- 27,31 ----
* @author Frederik Zimmer
*/
! public class StatusRemoteQueued extends Status implements Comparable {
private Integer queuePosition;
private Integer queueLength;
Index: StatusQueued.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/transfer/StatusQueued.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** StatusQueued.java 16 May 2003 13:01:34 -0000 1.1
--- StatusQueued.java 11 Jun 2003 22:46:27 -0000 1.2
***************
*** 27,31 ****
* @author Frederik Zimmer
*/
! public class StatusQueued extends Status {
protected Integer queuePosition;
--- 27,31 ----
* @author Frederik Zimmer
*/
! public class StatusQueued extends Status implements Comparable {
protected Integer queuePosition;
|
|
From: Frederik Z. <tri...@us...> - 2003-06-08 19:27:27
|
Update of /cvsroot/ziga/src/ziga/opennap/gui/config
In directory sc8-pr-cvs1:/tmp/cvs-serv30393/ziga/opennap/gui/config
Modified Files:
NetworkConfigurationComponent.java
Log Message:
don't allow invalid ports
Index: NetworkConfigurationComponent.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/gui/config/NetworkConfigurationComponent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NetworkConfigurationComponent.java 21 Jan 2002 21:48:10 -0000 1.2
--- NetworkConfigurationComponent.java 8 Jun 2003 19:27:23 -0000 1.3
***************
*** 24,37 ****
package ziga.opennap.gui.config;
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.*;
import java.io.IOException;
! import ziga.Module;
import ziga.ElementModule;
import ziga.gui.AbstractUserFrontend;
- import ziga.gui.SetupComponent;
- import ziga.gui.NumberTextField;
import ziga.gui.GUtil;
import ziga.gui.config.ConfigurationComponent;
import ziga.opennap.transfer.OpennapTransferManager;
--- 24,48 ----
package ziga.opennap.gui.config;
! import java.awt.Component;
! import java.awt.GridBagConstraints;
! import java.awt.GridBagLayout;
! import java.awt.Insets;
! import java.awt.event.ActionEvent;
! import java.awt.event.ActionListener;
import java.io.IOException;
!
! import javax.swing.BorderFactory;
! import javax.swing.BoxLayout;
! import javax.swing.JCheckBox;
! import javax.swing.JLabel;
! import javax.swing.JOptionPane;
! import javax.swing.JPanel;
!
import ziga.ElementModule;
+ import ziga.Module;
import ziga.gui.AbstractUserFrontend;
import ziga.gui.GUtil;
+ import ziga.gui.NumberTextField;
+ import ziga.gui.SetupComponent;
import ziga.gui.config.ConfigurationComponent;
import ziga.opennap.transfer.OpennapTransferManager;
***************
*** 39,43 ****
/**
*
- * @version 0.1 09/22/2001
* @author Frederik Zimmer
*/
--- 50,53 ----
***************
*** 309,313 ****
try {
! transferManager.setDataport(dataportField.getValue());
}
catch(IOException e) {
--- 319,333 ----
try {
! int dataport = dataportField.getValue();
! if (dataport > 0 && dataport <= 0xFFFF) {
! transferManager.setDataport(dataportField.getValue());
! } else {
! JOptionPane.showMessageDialog(
! mainComponent,
! messagesBundle.getString("network.port.invalid.msg"),
! messagesBundle.getString("network.port.invalid.title"),
! JOptionPane.ERROR_MESSAGE);
! return false;
! }
}
catch(IOException e) {
|
|
From: Frederik Z. <tri...@us...> - 2003-06-08 19:27:26
|
Update of /cvsroot/ziga/src/ziga/opennap/gui/config/resources In directory sc8-pr-cvs1:/tmp/cvs-serv30393/ziga/opennap/gui/config/resources Modified Files: ConfigurationMessages.properties ConfigurationMessages_de.properties Log Message: don't allow invalid ports Index: ConfigurationMessages.properties =================================================================== RCS file: /cvsroot/ziga/src/ziga/opennap/gui/config/resources/ConfigurationMessages.properties,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ConfigurationMessages.properties 16 May 2003 13:54:13 -0000 1.11 --- ConfigurationMessages.properties 8 Jun 2003 19:27:23 -0000 1.12 *************** *** 51,54 **** --- 51,56 ---- network.port.title=Dataport network.port.label=Port for incoming data-connections: + network.port.invalid.title=Invalid Port + network.port.invalid.msg=Only ports from 1 to 65535 allowed network.port.errorSetting=Error setting dataport network.bandwidth.title=Bandwidth Limits Index: ConfigurationMessages_de.properties =================================================================== RCS file: /cvsroot/ziga/src/ziga/opennap/gui/config/resources/ConfigurationMessages_de.properties,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ConfigurationMessages_de.properties 16 May 2003 13:54:13 -0000 1.11 --- ConfigurationMessages_de.properties 8 Jun 2003 19:27:23 -0000 1.12 *************** *** 51,54 **** --- 51,56 ---- network.port.title=Anschluß network.port.label=Anschluß für eingehende Verbindungen: + network.port.invalid.title=Ungültiger Anschluß + network.port.invalid.msg=Nur Anschlüsse von 1 bis 65535 erlaubt network.port.errorSetting=Fehler beim setzten des Anschlusses network.bandwidth.title=Bandbreitenbegrenzung |
|
From: Frederik Z. <tri...@us...> - 2003-06-07 11:31:42
|
Update of /cvsroot/ziga/src/ziga/opennap/transfer
In directory sc8-pr-cvs1:/tmp/cvs-serv11699/ziga/opennap/transfer
Modified Files:
OpennapTransferManager.java DownloadManager.java
StatusWaitingForSearch.java
Log Message:
fixed deadlock that could occur with locks setStatusLock and searchRequestQueue; allowed firewalled status to be set on a per server basis
Index: OpennapTransferManager.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/transfer/OpennapTransferManager.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** OpennapTransferManager.java 1 Jun 2003 22:15:52 -0000 1.33
--- OpennapTransferManager.java 7 Jun 2003 11:31:39 -0000 1.34
***************
*** 139,143 ****
protected GlobalTransferManager globalTransferManager;
protected int dataport;
! protected boolean firewalled;
protected final ArrayList resumeRequests = new ArrayList();
protected Listener listener;
--- 139,143 ----
protected GlobalTransferManager globalTransferManager;
protected int dataport;
! protected volatile boolean firewalled;
protected final ArrayList resumeRequests = new ArrayList();
protected Listener listener;
***************
*** 733,736 ****
--- 733,740 ----
public void setMaxSimultaneousDownloads(int maxSimDownloads) {
+ if (maxSimDownloads < maxSimDownloadsPerUser) {
+ maxSimDownloadsPerUser = maxSimDownloads;
+ }
+
if (this.maxSimDownloads < maxSimDownloads || maxSimDownloads == -1) {
this.maxSimDownloads = maxSimDownloads;
***************
*** 1308,1312 ****
}
! queued = currentDownloadsFromUser >= maxSimDownloadsPerUser;
if (!queued) {
--- 1312,1318 ----
}
! queued =
! haveMaxSimultaneousDownloadsLimit()
! && currentDownloadsFromUser >= maxSimDownloadsPerUser;
if (!queued) {
***************
*** 1373,1377 ****
}
! queued = currentDownloadsFromIP >= maxSimDownloadsPerUser;
if (!queued) {
--- 1379,1385 ----
}
! queued =
! haveMaxSimultaneousDownloadsLimit()
! && currentDownloadsFromIP >= maxSimDownloadsPerUser;
if (!queued) {
***************
*** 1745,1749 ****
currentUploads.add(upload);
! if (!firewalled) {
upload.waitForAccept();
} else {
--- 1753,1758 ----
currentUploads.add(upload);
! if (!(firewalled
! || user.getOrigin().isConnectionFirewalled())) {
upload.waitForAccept();
} else {
***************
*** 2290,2293 ****
--- 2299,2304 ----
public void findMoreSourcesForDownload(DownloadManager download) {
+ Status status = null;
+
synchronized (searchRequestQueue) {
if (indexOfInSearchRequestQueue(download) == -1) {
***************
*** 2297,2308 ****
findMoreSourcesHandler.start();
if (findMoreSourcesHandler.timerTask != null) {
! download.setStatus(
! new StatusWaitingForSearch(nextSearchTime(download)));
} else {
! download.setStatus(Status.WAITING);
}
}
}
}
--- 2308,2325 ----
findMoreSourcesHandler.start();
+
if (findMoreSourcesHandler.timerTask != null) {
! status =
! new StatusWaitingForSearch(nextSearchTime(download));
} else {
! status = Status.WAITING;
}
}
}
+
+ if (status != null) {
+ findMoreSourcesHandler.setStatusWaitingForSearch();
+ download.setStatus(status);
+ }
}
***************
*** 2388,2393 ****
}
searchRequestQueue.add(pos + 1, srqe);
-
- findMoreSourcesHandler.setStatusWaitingForSearch();
}
--- 2405,2408 ----
***************
*** 2416,2421 ****
downloadToPriorityMap.put(download, new Integer(priority));
}
synchronized (searchRequestQueue) {
! int index = indexOfInSearchRequestQueue(download);
if (index >= 0) {
adjustPositionInQueue(
--- 2431,2437 ----
downloadToPriorityMap.put(download, new Integer(priority));
}
+ int index;
synchronized (searchRequestQueue) {
! index = indexOfInSearchRequestQueue(download);
if (index >= 0) {
adjustPositionInQueue(
***************
*** 2423,2426 ****
--- 2439,2445 ----
}
}
+ if (index >= 0) {
+ findMoreSourcesHandler.setStatusWaitingForSearch();
+ }
}
***************
*** 3097,3101 ****
if (queuePosition == 0) {
! if (!firewalled) {
upload.waitForAccept();
} else {
--- 3116,3123 ----
if (queuePosition == 0) {
! if (!(firewalled
! || user
! .getOrigin()
! .isConnectionFirewalled())) {
upload.waitForAccept();
} else {
***************
*** 3458,3464 ****
public void run() {
synchronized (searchRequestQueue) {
timerTask = null;
! if (findMoreSources()) {
if (searchRequestQueue.size() > 0) {
timerTask = new DefaultTimerTask(this);
--- 3480,3489 ----
public void run() {
+ boolean doneFindMoreSources;
+
synchronized (searchRequestQueue) {
timerTask = null;
! doneFindMoreSources = findMoreSources();
! if (doneFindMoreSources) {
if (searchRequestQueue.size() > 0) {
timerTask = new DefaultTimerTask(this);
***************
*** 3474,3477 ****
--- 3499,3506 ----
}
}
+
+ if (doneFindMoreSources) {
+ setStatusWaitingForSearch();
+ }
}
***************
*** 3482,3492 ****
connections.add(event.getSource());
}
synchronized (searchRequestQueue) {
if (searchRequestQueue.size() > 0
! && (timerTask == null)) {
! setStatusWaitingForSearch();
start();
}
}
} else if (newStatus.isDisconnected()) {
synchronized (connections) {
--- 3511,3525 ----
connections.add(event.getSource());
}
+ boolean startedTimer = false;
synchronized (searchRequestQueue) {
if (searchRequestQueue.size() > 0
! && (timerTask == null)) {
start();
+ startedTimer = true;
}
}
+ if (startedTimer) {
+ setStatusWaitingForSearch();
+ }
} else if (newStatus.isDisconnected()) {
synchronized (connections) {
***************
*** 3540,3545 ****
qe.waitCycles++;
}
-
- setStatusWaitingForSearch();
Server[] servers =
--- 3573,3576 ----
***************
*** 3558,3581 ****
private void setStatus(Status status) {
synchronized (searchRequestQueue) {
! for (int i = searchRequestQueue.size() - 1; i >= 0; i--) {
! SearchRequestQueueEntry srqe =
! (SearchRequestQueueEntry) searchRequestQueue.get(i);
! srqe.downloadManager.setStatus(status);
! }
}
}
protected void setStatusWaitingForSearch() {
synchronized (searchRequestQueue) {
if (timerTask != null) {
! for (int i = searchRequestQueue.size() - 1; i >= 0; i--) {
! SearchRequestQueueEntry srqe =
! (SearchRequestQueueEntry) searchRequestQueue.get(
! i);
! srqe.downloadManager.setStatus(
! new StatusWaitingForSearch(
! nextSearchTime(srqe.downloadManager)));
! }
}
}
--- 3589,3626 ----
private void setStatus(Status status) {
+ ArrayList clonedSearchRequestQueue;
+
synchronized (searchRequestQueue) {
! clonedSearchRequestQueue =
! (ArrayList) searchRequestQueue.clone();
! }
!
! for (int i = clonedSearchRequestQueue.size() - 1; i >= 0; i--) {
! SearchRequestQueueEntry srqe =
! (SearchRequestQueueEntry) clonedSearchRequestQueue.get(i);
! srqe.downloadManager.setStatus(status);
}
}
protected void setStatusWaitingForSearch() {
+ ArrayList clonedSearchRequestQueue = null;
+
synchronized (searchRequestQueue) {
if (timerTask != null) {
! clonedSearchRequestQueue =
! (ArrayList) searchRequestQueue.clone();
! }
! }
!
! if (clonedSearchRequestQueue != null) {
! for (int i = clonedSearchRequestQueue.size() - 1;
! i >= 0;
! i--) {
! SearchRequestQueueEntry srqe =
! (SearchRequestQueueEntry) clonedSearchRequestQueue
! .get(i);
! srqe.downloadManager.setStatus(
! new StatusWaitingForSearch(
! nextSearchTime(srqe.downloadManager)));
}
}
Index: DownloadManager.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/transfer/DownloadManager.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** DownloadManager.java 1 Jun 2003 22:15:52 -0000 1.34
--- DownloadManager.java 7 Jun 2003 11:31:39 -0000 1.35
***************
*** 1751,1756 ****
} else if (isSearchInProgress()) {
status = Status.SEARCHING;
- } else if (newStatus instanceof StatusWaitingForSearch) {
- status = newStatus;
} else if (transferManager.isWaitingForSearch(this)) {
status =
--- 1751,1754 ----
***************
*** 1779,1783 ****
}
! if (oldStatus != status) {
if (oldStatus == Status.TRANSFERRING) {
stopBandwidthMeasurement();
--- 1777,1781 ----
}
! if (!oldStatus.equals(status)) {
if (oldStatus == Status.TRANSFERRING) {
stopBandwidthMeasurement();
Index: StatusWaitingForSearch.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/transfer/StatusWaitingForSearch.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** StatusWaitingForSearch.java 16 May 2003 13:03:16 -0000 1.1
--- StatusWaitingForSearch.java 7 Jun 2003 11:31:39 -0000 1.2
***************
*** 56,59 ****
--- 56,68 ----
return nextSearchTime;
}
+
+ public int hashCode() {
+ return (int) (nextSearchTime ^ (nextSearchTime >> 32));
+ }
+
+ public boolean equals(Object obj) {
+ return (obj instanceof StatusWaitingForSearch)
+ && ((StatusWaitingForSearch) obj).nextSearchTime == nextSearchTime;
+ }
}
|
|
From: Frederik Z. <tri...@us...> - 2003-06-07 11:27:17
|
Update of /cvsroot/ziga/src/ziga/opennap/gui/resources In directory sc8-pr-cvs1:/tmp/cvs-serv10822/ziga/opennap/gui/resources Modified Files: Messages.properties Messages_de.properties Log Message: allowed firewalled status to be set on a per server basis Index: Messages.properties =================================================================== RCS file: /cvsroot/ziga/src/ziga/opennap/gui/resources/Messages.properties,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Messages.properties 1 Jun 2003 22:10:31 -0000 1.21 --- Messages.properties 7 Jun 2003 11:27:13 -0000 1.22 *************** *** 146,149 **** --- 146,150 ---- connections.identDialog.emulateWinmx=Emulate WinMX (send //WantQueue) connections.identDialog.redirectServer=Redirect Server + connections.identDialog.connectionFirewalled=Connection firewalled connections.status.fetchingServerlist=Fetching Serverlist connections.status.connecting=Connecting Index: Messages_de.properties =================================================================== RCS file: /cvsroot/ziga/src/ziga/opennap/gui/resources/Messages_de.properties,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Messages_de.properties 1 Jun 2003 22:10:31 -0000 1.21 --- Messages_de.properties 7 Jun 2003 11:27:13 -0000 1.22 *************** *** 146,149 **** --- 146,150 ---- connections.identDialog.emulateWinmx=Emuliere WinMX (sende //WantQueue) connections.identDialog.redirectServer=Weiterleitungsserver + connections.identDialog.connectionFirewalled=Verbindung durch Firewall connections.status.fetchingServerlist=Hole Serverliste connections.status.connecting=Verbinde |
|
From: Frederik Z. <tri...@us...> - 2003-06-07 11:27:04
|
Update of /cvsroot/ziga/src/ziga/opennap/connection
In directory sc8-pr-cvs1:/tmp/cvs-serv10708/ziga/opennap/connection
Modified Files:
DefaultOpennapConnectionManager.java
Log Message:
allowed firewalled status to be set on a per server basis; fixed deadlock
Index: DefaultOpennapConnectionManager.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/connection/DefaultOpennapConnectionManager.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** DefaultOpennapConnectionManager.java 1 Jun 2003 22:19:08 -0000 1.32
--- DefaultOpennapConnectionManager.java 7 Jun 2003 11:26:59 -0000 1.33
***************
*** 168,177 ****
protected volatile int maxSearchResultsPerServer =
DEFAULT_MAX_SEARCH_RESULTS_PER_SERVER;
! protected volatile int linkType;
protected volatile boolean defaultRandomUser;
protected volatile String defaultUsername;
protected volatile String defaultPassword;
protected volatile String defaultEmail;
! protected volatile boolean defaultEmulateWinmx;
protected volatile String directBrowseUsername;
protected ConnectThread connectThread = new ConnectThread();
--- 168,177 ----
protected volatile int maxSearchResultsPerServer =
DEFAULT_MAX_SEARCH_RESULTS_PER_SERVER;
! protected volatile int linkType = 0;
protected volatile boolean defaultRandomUser;
protected volatile String defaultUsername;
protected volatile String defaultPassword;
protected volatile String defaultEmail;
! protected volatile boolean defaultEmulateWinmx = true;
protected volatile String directBrowseUsername;
protected ConnectThread connectThread = new ConnectThread();
***************
*** 184,189 ****
protected long detectedServersRequestTime;
protected volatile Authenticator authenticator;
! protected volatile int daysToDeadServer;
! protected volatile boolean promptBeforeDeletingDeadServer;
protected volatile RemoveDeadServersListener removeDeadServersListener;
protected long startTime;
--- 184,189 ----
protected long detectedServersRequestTime;
protected volatile Authenticator authenticator;
! protected volatile int daysToDeadServer = -1;
! protected volatile boolean promptBeforeDeletingDeadServer = true;
protected volatile RemoveDeadServersListener removeDeadServersListener;
protected long startTime;
***************
*** 202,210 ****
}
- linkType = 0;
- defaultEmulateWinmx = true;
- daysToDeadServer = -1;
- promptBeforeDeletingDeadServer = true;
-
for (int i = 0; i < ea.length; i++) {
ElementAttribute attribute = ea[i];
--- 202,205 ----
***************
*** 809,818 ****
*/
public void autoconnect() {
synchronized (favServers) {
! for (int i = 0; i < favServers.size(); i++) {
! Network network = (Network) favServers.get(i);
! if (network.isAutoconnect()) {
! connectToNetwork(network, false);
! }
}
}
--- 804,815 ----
*/
public void autoconnect() {
+ ArrayList clonedFavServers;
synchronized (favServers) {
! clonedFavServers = (ArrayList) favServers.clone();
! }
! for (int i = 0; i < clonedFavServers.size(); i++) {
! Network network = (Network) clonedFavServers.get(i);
! if (network.isAutoconnect()) {
! connectToNetwork(network, false);
}
}
***************
*** 938,941 ****
--- 935,940 ----
}
} else {
+ Server server = null;
+
synchronized (favServers) {
Server[] servers = network.getServers();
***************
*** 943,955 ****
if (servers[i].getLastConnectionAttempt() < startTime
&& servers[i].getIP() != null) {
! if (makeConnection(servers[i], forceConnection)) {
! return true;
! }
}
}
}
synchronized (connectingServers) {
- Server server = getServer(null, -1, network);
OpennapConnectionHandler handler =
new OpennapConnectionHandler(this, server, true);
--- 942,957 ----
if (servers[i].getLastConnectionAttempt() < startTime
&& servers[i].getIP() != null) {
! server = servers[i];
}
}
}
+
+ if (makeConnection(server, forceConnection)) {
+ return true;
+ }
+
+ server = getServer(null, -1, network);
synchronized (connectingServers) {
OpennapConnectionHandler handler =
new OpennapConnectionHandler(this, server, true);
***************
*** 1041,1045 ****
int dataport;
! if (contentModel.getTransferManager().isFirewalled()) {
dataport = 0;
} else {
--- 1043,1048 ----
int dataport;
! if (contentModel.getTransferManager().isFirewalled()
! || server.isConnectionFirewalled()) {
dataport = 0;
} else {
***************
*** 1427,1438 ****
}
} else {
! synchronized (connections) {
! for (int i = 0; i < servers.length; i++) {
! OpennapConnectionHandler handler =
! getConnection(servers[i]);
! if (handler != null) {
! re.addConnection(handler);
! handler.send(rrMsg);
! }
}
}
--- 1430,1438 ----
}
} else {
! for (int i = 0; i < servers.length; i++) {
! OpennapConnectionHandler handler = getConnection(servers[i]);
! if (handler != null) {
! re.addConnection(handler);
! handler.send(rrMsg);
}
}
|
|
From: Frederik Z. <tri...@us...> - 2003-06-07 11:26:16
|
Update of /cvsroot/ziga/src/ziga/opennap/connection
In directory sc8-pr-cvs1:/tmp/cvs-serv10532/ziga/opennap/connection
Modified Files:
OpennapConnectionHandler.java
Log Message:
allowed firewalled status to be set on a per server basis
Index: OpennapConnectionHandler.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/connection/OpennapConnectionHandler.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** OpennapConnectionHandler.java 1 Jun 2003 22:19:07 -0000 1.23
--- OpennapConnectionHandler.java 7 Jun 2003 11:26:13 -0000 1.24
***************
*** 366,370 ****
.getContentModel()
.getTransferManager()
! .isFirewalled()) {
dataport = 0;
} else {
--- 366,371 ----
.getContentModel()
.getTransferManager()
! .isFirewalled()
! || server.isConnectionFirewalled()) {
dataport = 0;
} else {
|
|
From: Frederik Z. <tri...@us...> - 2003-06-07 11:23:21
|
Update of /cvsroot/ziga/src/ziga/opennap/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv9877/ziga/opennap/gui
Modified Files:
DefaultOpennapConnectionsComponent.java
Log Message:
allowed firewalled status to be set on a per server basis
Index: DefaultOpennapConnectionsComponent.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/gui/DefaultOpennapConnectionsComponent.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** DefaultOpennapConnectionsComponent.java 1 Jun 2003 22:10:31 -0000 1.16
--- DefaultOpennapConnectionsComponent.java 7 Jun 2003 11:23:18 -0000 1.17
***************
*** 105,108 ****
--- 105,109 ----
import ziga.opennap.connection.RemoveDeadServersListener;
import ziga.opennap.gui.table.BooleanTableCellRenderer;
+ import ziga.opennap.gui.table.OpennapConnectionStatusTableComparator;
import ziga.opennap.message.client.ChangeUserPasswordMessage;
import ziga.opennap.message.server.Message;
***************
*** 110,114 ****
import ziga.opennap.message.server.MessageFactory;
import ziga.opennap.message.server.MessageListener;
! import ziga.util.ConnectionStatusTableComparator;
import ziga.util.ListDataEvent;
import ziga.util.ListDataListener;
--- 111,115 ----
import ziga.opennap.message.server.MessageFactory;
import ziga.opennap.message.server.MessageListener;
! import ziga.opennap.transfer.OpennapTransferManager;
import ziga.util.ListDataEvent;
import ziga.util.ListDataListener;
***************
*** 152,155 ****
--- 153,157 ----
new UpdateNetworksTableJob();
protected OpennapConnectionManager conManager;
+ protected OpennapTransferManager transferManager;
protected NetworksModel networksModel;
protected SortableTreeTableModelAdapter sortableNetworkModel;
***************
*** 264,270 ****
DefaultRootContentModel rcm = getRootModule().getRootContentModel();
! conManager =
! ((OpennapContentModel) rcm.getModule(OpennapContentModel.class))
! .getConnectionManager();
Element[] e = elementModule.getChildren();
--- 266,273 ----
DefaultRootContentModel rcm = getRootModule().getRootContentModel();
! OpennapContentModel contentModel =
! (OpennapContentModel) rcm.getModule(OpennapContentModel.class);
! conManager = contentModel.getConnectionManager();
! transferManager = contentModel.getTransferManager();
Element[] e = elementModule.getChildren();
***************
*** 303,307 ****
networksModel.setDefaultComparator(
Status.class,
! ConnectionStatusTableComparator.getInstance());
networksColumnModel =
ExtendedTableColumnUtil.createDefaultTableColumnModel(
--- 306,310 ----
networksModel.setDefaultComparator(
Status.class,
! OpennapConnectionStatusTableComparator.getInstance());
networksColumnModel =
ExtendedTableColumnUtil.createDefaultTableColumnModel(
***************
*** 525,528 ****
--- 528,532 ----
server.setEmulateWinmx(ident.emulateWinmx);
server.setRedirectServer(ident.redirectServer);
+ server.setConnectionFirewalled(ident.connectionFirewalled);
return server;
}
***************
*** 821,829 ****
}
! if (!newStatus.isDisconnected()) {
! sortableNetworkModel.storeSelections(networksTable);
! resort();
! sortableNetworkModel.restoreSelections(networksTable);
! }
}
});
--- 825,831 ----
}
! sortableNetworkModel.storeSelections(networksTable);
! resort();
! sortableNetworkModel.restoreSelections(networksTable);
}
});
***************
*** 1648,1651 ****
--- 1650,1655 ----
private JCheckBox emulateWinmxCheckBox;
private JCheckBox redirectServerCheckBox;
+ private JCheckBox connectionFirewalledCheckBox;
+ private boolean connectionFirewalled;
private JButton okButton;
private JButton cancelButton;
***************
*** 1793,1796 ****
--- 1797,1808 ----
c.gridy++;
GUtil.add(inputPanel, redirectServerCheckBox, c);
+
+ connectionFirewalledCheckBox =
+ new JCheckBox(
+ getMessagesBundle().getString(
+ "connections.identDialog.connectionFirewalled"),
+ true);
+ c.gridy++;
+ GUtil.add(inputPanel, connectionFirewalledCheckBox, c);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
***************
*** 1838,1841 ****
--- 1850,1858 ----
emulateWinmxCheckBox.setSelected(server.isEmulateWinmx());
redirectServerCheckBox.setSelected(server.isRedirectServer());
+ connectionFirewalledCheckBox.setEnabled(!transferManager.isFirewalled());
+ connectionFirewalledCheckBox.setSelected(
+ !connectionFirewalledCheckBox.isEnabled()
+ || server.isConnectionFirewalled());
+ connectionFirewalled = server.isConnectionFirewalled();
}
***************
*** 1868,1872 ****
email,
emulateWinmxCheckBox.isSelected(),
! redirectServerCheckBox.isSelected());
dispose();
}
--- 1885,1892 ----
email,
emulateWinmxCheckBox.isSelected(),
! redirectServerCheckBox.isSelected(),
! connectionFirewalledCheckBox.isEnabled()
! ? connectionFirewalledCheckBox.isSelected()
! : connectionFirewalled);
dispose();
}
***************
*** 1893,1896 ****
--- 1913,1917 ----
boolean emulateWinmx;
boolean redirectServer;
+ boolean connectionFirewalled;
public Ident(
***************
*** 1902,1906 ****
String email,
boolean emulateWinmx,
! boolean redirectServer) {
this.hostname = hostname;
this.port = port;
--- 1923,1928 ----
String email,
boolean emulateWinmx,
! boolean redirectServer,
! boolean connectionFirewalled) {
this.hostname = hostname;
this.port = port;
***************
*** 1911,1914 ****
--- 1933,1937 ----
this.emulateWinmx = emulateWinmx;
this.redirectServer = redirectServer;
+ this.connectionFirewalled = connectionFirewalled;
}
}
|
|
From: Frederik Z. <tri...@us...> - 2003-06-07 11:23:21
|
Update of /cvsroot/ziga/src/ziga/opennap/connection
In directory sc8-pr-cvs1:/tmp/cvs-serv9877/ziga/opennap/connection
Modified Files:
WSXServerlistReader.java
Log Message:
allowed firewalled status to be set on a per server basis
Index: WSXServerlistReader.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/connection/WSXServerlistReader.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** WSXServerlistReader.java 1 Jun 2003 22:19:07 -0000 1.4
--- WSXServerlistReader.java 7 Jun 2003 11:23:18 -0000 1.5
***************
*** 58,61 ****
--- 58,62 ----
private static final String LAST_COUNTED_FAILED_LOGIN =
"LAST_COUNTED_FAILED_LOGIN";
+ private static final String FIREWALLED = "FIREWALLED";
private static final String NAME_VALUE_DELIM = ": ";
private static final String NOT_AVAILABLE = "N/A";
***************
*** 212,215 ****
--- 213,222 ----
out.newLine();
}
+ if (server.isConnectionFirewalled()) {
+ out.write(FIREWALLED);
+ out.write(NAME_VALUE_DELIM);
+ out.write((new Boolean(true)).toString());
+ out.newLine();
+ }
}
out.write(ADDRESS);
***************
*** 243,246 ****
--- 250,254 ----
int failedLoginDays = -1;
long lastCountedFailedLogin = -1;
+ boolean connectionFirewalled = false;
try {
***************
*** 284,288 ****
failedLoginDays,
lastCountedFailedLogin,
! serverList);
address = null;
port = -1;
--- 292,297 ----
failedLoginDays,
lastCountedFailedLogin,
! serverList,
! connectionFirewalled);
address = null;
port = -1;
***************
*** 296,299 ****
--- 305,309 ----
failedLoginDays = -1;
lastCountedFailedLogin = -1;
+ connectionFirewalled = false;
} else if (valueName.equals(PORT)) {
try {
***************
*** 335,338 ****
--- 345,351 ----
} catch (NumberFormatException e) {
}
+ } else if (valueName.equals(FIREWALLED)) {
+ connectionFirewalled =
+ (new Boolean(value)).booleanValue();
}
}
***************
*** 362,366 ****
int failedLoginDays,
long lastCountedFailedLogin,
! ArrayList serverList) {
if (port == -1 && address != null) {
int index = address.lastIndexOf(':');
--- 375,380 ----
int failedLoginDays,
long lastCountedFailedLogin,
! ArrayList serverList,
! boolean connectionFirewalled) {
if (port == -1 && address != null) {
int index = address.lastIndexOf(':');
***************
*** 422,425 ****
--- 436,440 ----
server.setLastCountedFailedLogin(lastCountedFailedLogin);
}
+ server.setConnectionFirewalled(connectionFirewalled);
serverList.add(server);
}
|
|
From: Frederik Z. <tri...@us...> - 2003-06-07 11:23:21
|
Update of /cvsroot/ziga/src/ziga/opennap
In directory sc8-pr-cvs1:/tmp/cvs-serv9877/ziga/opennap
Modified Files:
Server.java
Log Message:
allowed firewalled status to be set on a per server basis
Index: Server.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/opennap/Server.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Server.java 1 Jun 2003 22:19:08 -0000 1.2
--- Server.java 7 Jun 2003 11:23:18 -0000 1.3
***************
*** 38,41 ****
--- 38,42 ----
protected int port;
protected boolean redirectServer;
+ protected volatile boolean connectionFirewalled;
protected String username;
protected String password;
***************
*** 56,59 ****
--- 57,61 ----
failedLoginDays = 0;
lastCountedFailedLogin = -1;
+ connectionFirewalled = false;
}
***************
*** 111,114 ****
--- 113,117 ----
failedLoginDays = 0;
lastCountedFailedLogin = -1;
+ connectionFirewalled = false;
}
***************
*** 252,255 ****
--- 255,266 ----
long lastCountedFailedLogin) {
this.lastCountedFailedLogin = lastCountedFailedLogin;
+ }
+
+ public boolean isConnectionFirewalled() {
+ return connectionFirewalled;
+ }
+
+ public void setConnectionFirewalled(boolean b) {
+ connectionFirewalled = b;
}
|
|
From: Frederik Z. <tri...@us...> - 2003-06-07 11:22:50
|
Update of /cvsroot/ziga/src/ziga/opennap/gui/table In directory sc8-pr-cvs1:/tmp/cvs-serv9731/ziga/opennap/gui/table Added Files: OpennapConnectionStatusTableComparator.java Log Message: sort status "Logged in" on top --- NEW FILE: OpennapConnectionStatusTableComparator.java --- /* * 06/03/2003 * * OpennapConnectionStatusTableComparator.java * Copyright (C) 2003 Frederik Zimmer * tri...@us... * http://sourceforge.net/projects/ziga/ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package ziga.opennap.gui.table; import ziga.connection.Status; import ziga.util.AbstractTableComparator; import ziga.util.ConnectionStatusComparator; /** * * @author Frederik Zimmer */ public class OpennapConnectionStatusTableComparator extends AbstractTableComparator { protected static OpennapConnectionStatusTableComparator c = null; protected ConnectionStatusComparator connectionStatusComparator; public OpennapConnectionStatusTableComparator() { connectionStatusComparator = ConnectionStatusComparator.getInstance(); } public static OpennapConnectionStatusTableComparator getInstance() { if (c == null) { c = new OpennapConnectionStatusTableComparator(); } return c; } public int compare(Object o1, Object o2) { Object value1 = getValue(o1); Object value2 = getValue(o2); if (value1 != value2) { if (value1 == Status.LOGGED_IN) { return -1; } else if (value2 == Status.LOGGED_IN) { return 1; } } return connectionStatusComparator.compare(value1, value2); } } |
|
From: Frederik Z. <tri...@us...> - 2003-06-03 14:48:46
|
Update of /cvsroot/ziga/src/ziga/global
In directory sc8-pr-cvs1:/tmp/cvs-serv30577/ziga/global
Modified Files:
ChatManager.java
Log Message:
trim away message in configuration component
Index: ChatManager.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/global/ChatManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ChatManager.java 29 Jan 2003 16:53:34 -0000 1.3
--- ChatManager.java 3 Jun 2003 14:48:42 -0000 1.4
***************
*** 87,94 ****
public void setAwayMessage(String awayMessage) {
! this.awayMessage = awayMessage.trim();
! if (awayMessage.length() == 0) {
! this.awayMessage = null;
! }
}
--- 87,91 ----
public void setAwayMessage(String awayMessage) {
! this.awayMessage = awayMessage;
}
|
|
From: Frederik Z. <tri...@us...> - 2003-06-03 14:48:46
|
Update of /cvsroot/ziga/src/ziga/global/gui/config
In directory sc8-pr-cvs1:/tmp/cvs-serv30577/ziga/global/gui/config
Modified Files:
ChatConfigurationComponent.java
Log Message:
trim away message in configuration component
Index: ChatConfigurationComponent.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/global/gui/config/ChatConfigurationComponent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ChatConfigurationComponent.java 8 Apr 2002 17:15:02 -0000 1.1
--- ChatConfigurationComponent.java 3 Jun 2003 14:48:41 -0000 1.2
***************
*** 24,36 ****
package ziga.global.gui.config;
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.*;
! import javax.swing.border.TitledBorder;
! import ziga.*;
import ziga.gui.AbstractUserFrontend;
import ziga.gui.GUtil;
import ziga.gui.config.ConfigurationComponent;
- import ziga.global.ChatManager;
/**
--- 24,49 ----
package ziga.global.gui.config;
! import java.awt.Component;
! import java.awt.Dimension;
! import java.awt.GridBagConstraints;
! import java.awt.GridBagLayout;
! import java.awt.Insets;
! import java.awt.event.ActionEvent;
! import java.awt.event.ActionListener;
!
! import javax.swing.BorderFactory;
! import javax.swing.Box;
! import javax.swing.BoxLayout;
! import javax.swing.JCheckBox;
! import javax.swing.JPanel;
! import javax.swing.JScrollPane;
! import javax.swing.JTextArea;
!
! import ziga.ElementModule;
! import ziga.Module;
! import ziga.global.ChatManager;
import ziga.gui.AbstractUserFrontend;
import ziga.gui.GUtil;
import ziga.gui.config.ConfigurationComponent;
/**
***************
*** 98,103 ****
public boolean updateContent() {
! String awayMessage = sendAwayMessageCheckBox.isSelected()
! ? awayMessageTextArea.getText() : null;
chatManager.setAwayMessage(awayMessage);
return true;
--- 111,121 ----
public boolean updateContent() {
! String awayMessage =
! sendAwayMessageCheckBox.isSelected()
! ? awayMessageTextArea.getText().trim()
! : null;
! if (awayMessage != null && awayMessage.length() == 0) {
! awayMessage = null;
! }
chatManager.setAwayMessage(awayMessage);
return true;
|
|
From: Frederik Z. <tri...@us...> - 2003-06-01 23:15:23
|
Update of /cvsroot/ziga/src
In directory sc8-pr-cvs1:/tmp/cvs-serv3038
Modified Files:
build.xml
Log Message:
include new connection *.properties
Index: build.xml
===================================================================
RCS file: /cvsroot/ziga/src/build.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** build.xml 6 May 2003 09:26:50 -0000 1.4
--- build.xml 1 Jun 2003 23:15:18 -0000 1.5
***************
*** 128,137 ****
<copy todir="${build}">
<fileset dir="${src}">
! <include name="ziga/global/**/*.properties" />
! <include name="ziga/gui/**/*.properties" />
<include name="ziga/gui/**/*.ico" />
- <include name="ziga/resources/*.properties" />
<include name="ziga/resources/*.gif" />
- <include name="ziga/transfer/**/*.properties" />
</fileset>
</copy>
--- 128,134 ----
<copy todir="${build}">
<fileset dir="${src}">
! <include name="ziga/**/*.properties" />
<include name="ziga/gui/**/*.ico" />
<include name="ziga/resources/*.gif" />
</fileset>
</copy>
|
|
From: Frederik Z. <tri...@us...> - 2003-06-01 23:03:07
|
Update of /cvsroot/ziga/src/ziga/gnutella/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv32027/ziga/gnutella/gui
Modified Files:
ConnectionsComponent.java
Log Message:
changed type of connection status from int to Status.class
Index: ConnectionsComponent.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/gnutella/gui/ConnectionsComponent.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ConnectionsComponent.java 1 Jun 2003 22:35:47 -0000 1.5
--- ConnectionsComponent.java 1 Jun 2003 23:03:04 -0000 1.6
***************
*** 30,33 ****
--- 30,34 ----
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
+ import java.util.ArrayList;
import javax.swing.BorderFactory;
***************
*** 42,55 ****
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
! import javax.swing.table.DefaultTableColumnModel;
import ziga.DefaultRootContentModel;
import ziga.ElementModule;
import ziga.Module;
- import ziga.UnknownElement;
import ziga.connection.ConnectionStatusEvent;
import ziga.connection.ConnectionStatusListener;
import ziga.connection.Status;
- import ziga.connection.StatusCustomError;
import ziga.gnutella.ContentModel;
import ziga.gnutella.connection.ConnectionManager;
--- 43,54 ----
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
! import javax.swing.table.AbstractTableModel;
import ziga.DefaultRootContentModel;
import ziga.ElementModule;
import ziga.Module;
import ziga.connection.ConnectionStatusEvent;
import ziga.connection.ConnectionStatusListener;
import ziga.connection.Status;
import ziga.gnutella.ContentModel;
import ziga.gnutella.connection.ConnectionManager;
***************
*** 57,67 ****
import ziga.gui.AbstractUserFrontend;
import ziga.gui.NumberTextField;
- import ziga.gui.event.SortTableHeaderListener;
- import ziga.gui.table.AbstractAdaptableColumnTableModel;
- import ziga.gui.table.ColumnSelector;
- import ziga.gui.table.ConnectionStatusRenderer;
- import ziga.gui.table.ExtendedTableColumn;
- import ziga.gui.table.ExtendedTableColumnUtil;
- import XMLtp.Element;
/**
--- 56,59 ----
***************
*** 71,88 ****
public class ConnectionsComponent extends AbstractUserFrontend {
- protected static final ExtendedTableColumn[] CONNECTIONS_TABLE_COLUMNS = {
- new ExtendedTableColumn("host", String.class),
- new ExtendedTableColumn("status", Status.class),
- new ExtendedTableColumn("userAgent", String.class),
- new ExtendedTableColumn("type", String.class)
- };
- protected static final String CONFIG_CONNECTIONS_TABLE_NAME =
- "connections";
protected ConnectionManager conManager;
protected JPanel mainComponent;
! protected ExtendedTableColumn[] connectionsColumns;
! protected DefaultTableColumnModel connectionsColumnModel;
! protected ConnectionsModel connectionsModel;
! protected JTable connectionsTable;
protected JTextField ipField;
protected NumberTextField portField;
--- 63,70 ----
public class ConnectionsComponent extends AbstractUserFrontend {
protected ConnectionManager conManager;
protected JPanel mainComponent;
! protected JTable table;
! protected ConnectionsModel tableModel;
protected JTextField ipField;
protected NumberTextField portField;
***************
*** 98,102 ****
public void linkUp() {
! conManager.addConnectionStatusListener(connectionsModel);
super.linkUp();
}
--- 80,84 ----
public void linkUp() {
! conManager.addConnectionStatusListener(tableModel);
super.linkUp();
}
***************
*** 109,124 ****
((ContentModel) rcm.getModule(ContentModel.class))
.getConnectionManager();
-
- Element[] e = elementModule.getChildren();
-
- ExtendedTableColumnUtil.initColumns(
- CONNECTIONS_TABLE_COLUMNS,
- getMessagesBundle(),
- "connections.table.");
- connectionsColumns =
- ExtendedTableColumnUtil.getColumns(
- CONFIG_CONNECTIONS_TABLE_NAME,
- e,
- CONNECTIONS_TABLE_COLUMNS);
mainComponent = new JPanel();
--- 91,94 ----
***************
*** 131,156 ****
messagesBundle.getString("connections.conTitle")));
! connectionsModel =
! new ConnectionsModel(
! connectionsColumns.length,
! CONNECTIONS_TABLE_COLUMNS);
! connectionsColumnModel =
! ExtendedTableColumnUtil.createDefaultTableColumnModel(
! connectionsColumns);
! connectionsTable =
! new JTable(connectionsModel, connectionsColumnModel);
! connectionsTable.setDefaultRenderer(
! Status.class,
! new ConnectionStatusRenderer());
!
! connectionsTable.getTableHeader().addMouseListener(
! new SortTableHeaderListener(connectionsTable));
!
! connectionsTable.getTableHeader().addMouseListener(
! new ColumnSelector(connectionsTable, CONNECTIONS_TABLE_COLUMNS));
! connectionsColumnModel.addColumnModelListener(
! connectionsModel.new AddRemoveColumnListener());
!
! JScrollPane scrollPane = new JScrollPane(connectionsTable);
conPanel.add(scrollPane);
--- 101,107 ----
messagesBundle.getString("connections.conTitle")));
! tableModel = new ConnectionsModel();
! table = new JTable(tableModel);
! JScrollPane scrollPane = new JScrollPane(table);
conPanel.add(scrollPane);
***************
*** 208,232 ****
super.deinitialize();
! conManager.removeConnectionStatusListener(connectionsModel);
!
! Element[] e = elementModule.getChildren();
! if (e != null) {
! for (int i = 0; i < e.length; i++) {
! if (e[i] instanceof UnknownElement
! && e[i].getElementName().equalsIgnoreCase(
! ExtendedTableColumnUtil.TABLE_ELEMENT)) {
! elementModule.removeChild(e[i]);
! }
! }
! }
!
! try {
! Element connectionsTableElement =
! ExtendedTableColumnUtil.getTableElement(
! CONFIG_CONNECTIONS_TABLE_NAME,
! connectionsColumnModel);
! elementModule.addChild(connectionsTableElement);
! } catch (Exception ex) {
! }
}
--- 159,163 ----
super.deinitialize();
! conManager.removeConnectionStatusListener(tableModel);
}
***************
*** 244,251 ****
protected void disconnect() {
! int[] indices = connectionsTable.getSelectedRows();
for (int i = 0; i < indices.length; i++) {
! GnutellaConnectionHandler con =
! connectionsModel.getEntryAt(indices[i]);
conManager.disconnect(con);
}
--- 175,181 ----
protected void disconnect() {
! int[] indices = table.getSelectedRows();
for (int i = 0; i < indices.length; i++) {
! GnutellaConnectionHandler con = tableModel.getEntryAt(indices[i]);
conManager.disconnect(con);
}
***************
*** 253,273 ****
private class ConnectionsModel
! extends AbstractAdaptableColumnTableModel
implements ConnectionStatusListener {
! private final String TYPE_ULTRAPEER =
! getMessagesBundle().getString("connections.type.ultrapeer");
! private final String TYPE_LEAF =
! getMessagesBundle().getString("connections.type.leaf");
! private final String TYPE_NORMAL =
! getMessagesBundle().getString("connections.type.normal");
! public ConnectionsModel(
! int columnCount,
! ExtendedTableColumn[] columns) {
! super(columnCount, columns);
}
! public Object getValueAt(Object element, int column) {
GnutellaConnectionHandler handler =
! (GnutellaConnectionHandler) element;
switch (column) {
--- 183,210 ----
private class ConnectionsModel
! extends AbstractTableModel
implements ConnectionStatusListener {
! protected String[] columnNames = {
! getMessagesBundle().getString("connections.table.host"),
! getMessagesBundle().getString("connections.table.status"),
! getMessagesBundle().getString("connections.table.userAgent"),
! };
! protected ArrayList connections = new ArrayList();
!
! public int getColumnCount() {
! return columnNames.length;
}
! public int getRowCount() {
! return connections.size();
! }
!
! public String getColumnName(int column) {
! return columnNames[column];
! }
!
! public Object getValueAt(int row, int column) {
GnutellaConnectionHandler handler =
! (GnutellaConnectionHandler) connections.get(row);
switch (column) {
***************
*** 278,293 ****
case 2 :
return handler.getUserAgent();
- case 3 :
- if (handler.getStatus() == Status.CONNECTED
- || handler.getStatus()
- instanceof StatusCustomError) {
- if (handler.isUltrapeer()) {
- return TYPE_ULTRAPEER;
- } else if (!handler.isRemoteNormalPeer()) {
- return TYPE_LEAF;
- } else {
- return TYPE_NORMAL;
- }
- }
}
--- 215,218 ----
***************
*** 296,302 ****
public GnutellaConnectionHandler getEntryAt(int row) {
! return (GnutellaConnectionHandler) entries.get(row);
}
!
public void connectionStatusChanged(
final ConnectionStatusEvent event) {
--- 221,227 ----
public GnutellaConnectionHandler getEntryAt(int row) {
! return (GnutellaConnectionHandler) connections.get(row);
}
!
public void connectionStatusChanged(
final ConnectionStatusEvent event) {
***************
*** 305,309 ****
Status newStatus = event.getNewStatus();
if (newStatus == Status.CONNECTING) {
! addEntry(event.getSource());
} else if (newStatus.isDisconnected()) {
delayDisconnectEvent(event);
--- 230,235 ----
Status newStatus = event.getNewStatus();
if (newStatus == Status.CONNECTING) {
! connections.add(event.getSource());
! fireTableDataChanged();
} else if (newStatus.isDisconnected()) {
delayDisconnectEvent(event);
***************
*** 315,326 ****
}
! protected void delayDisconnectEvent(
! final ConnectionStatusEvent connectionStatusEvent) {
if (connectionStatusEvent.getSource()
! instanceof GnutellaConnectionHandler
! && ((GnutellaConnectionHandler) connectionStatusEvent
! .getSource())
! .getStatus()
! != Status.DISCONNECTED_BY_USER) {
new Thread() {
public void run() {
--- 241,251 ----
}
! protected void delayDisconnectEvent(final ConnectionStatusEvent connectionStatusEvent) {
if (connectionStatusEvent.getSource()
! instanceof GnutellaConnectionHandler
! && ((GnutellaConnectionHandler) connectionStatusEvent
! .getSource())
! .getStatus()
! != Status.DISCONNECTED_BY_USER) {
new Thread() {
public void run() {
***************
*** 343,348 ****
}
! protected void fireDisconnectEvent(ConnectionStatusEvent event) {
! removeEntry(event.getSource());
}
--- 268,274 ----
}
! private void fireDisconnectEvent(ConnectionStatusEvent connectionStatusEvent) {
! connections.remove(connectionStatusEvent.getSource());
! fireTableDataChanged();
}
***************
*** 364,368 ****
protected class MinConnectionsDocumentListener
! implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
--- 290,294 ----
protected class MinConnectionsDocumentListener
! implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
***************
*** 382,386 ****
protected class MaxConnectionsDocumentListener
! implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
--- 308,312 ----
protected class MaxConnectionsDocumentListener
! implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
|
|
From: Frederik Z. <tri...@us...> - 2003-06-01 23:02:39
|
Update of /cvsroot/ziga/src/ziga/gnutella
In directory sc8-pr-cvs1:/tmp/cvs-serv31829/ziga/gnutella
Modified Files:
RoutingTable.java
Log Message:
changed type of connection status from int to Status.class
Index: RoutingTable.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/gnutella/RoutingTable.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** RoutingTable.java 1 Jul 2002 17:24:06 -0000 1.7
--- RoutingTable.java 1 Jun 2003 23:02:36 -0000 1.8
***************
*** 24,39 ****
package ziga.gnutella;
- import javax.swing.event.EventListenerList;
import java.util.ArrayList;
import java.util.HashMap;
- import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
! import ziga.connection.ConnectionStatusListener;
import ziga.connection.ConnectionStatusEvent;
import ziga.gnutella.connection.DefaultConnectionManager;
import ziga.gnutella.connection.GnutellaConnectionHandler;
! import ziga.gnutella.message.*;
! import ziga.gnutella.message.event.*;
/**
--- 24,52 ----
package ziga.gnutella;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;
!
! import javax.swing.event.EventListenerList;
!
import ziga.connection.ConnectionStatusEvent;
+ import ziga.connection.ConnectionStatusListener;
+ import ziga.connection.Status;
import ziga.gnutella.connection.DefaultConnectionManager;
import ziga.gnutella.connection.GnutellaConnectionHandler;
! import ziga.gnutella.message.IndexingQueryMessage;
! import ziga.gnutella.message.Message;
! import ziga.gnutella.message.PingMessage;
! import ziga.gnutella.message.PongMessage;
! import ziga.gnutella.message.PushMessage;
! import ziga.gnutella.message.QueryHitMessage;
! import ziga.gnutella.message.QueryMessage;
! import ziga.gnutella.message.event.PushEvent;
! import ziga.gnutella.message.event.PushListener;
! import ziga.gnutella.message.event.QueryHitEvent;
! import ziga.gnutella.message.event.QueryHitListener;
! import ziga.gnutella.message.event.QueryHitMonitorListener;
! import ziga.gnutella.message.event.QueryListener;
/**
***************
*** 372,378 ****
}
! public void connectionStatusChanged(ConnectionStatusEvent connectionStatusEvent) {
! if (connectionStatusEvent.getID() == ConnectionStatusEvent.DISCONNECTED) {
! GnutellaConnectionHandler con = (GnutellaConnectionHandler) connectionStatusEvent.getSource();
synchronized(pushRoutingTable) {
Iterator i = pushRoutingTable.values().iterator();
--- 385,392 ----
}
! public void connectionStatusChanged(ConnectionStatusEvent event) {
! Status newStatus = event.getNewStatus();
! if (newStatus.isDisconnected()) {
! GnutellaConnectionHandler con = (GnutellaConnectionHandler) event.getSource();
synchronized(pushRoutingTable) {
Iterator i = pushRoutingTable.values().iterator();
|
|
From: Frederik Z. <tri...@us...> - 2003-06-01 23:02:39
|
Update of /cvsroot/ziga/src/ziga/gnutella/transfer
In directory sc8-pr-cvs1:/tmp/cvs-serv31829/ziga/gnutella/transfer
Modified Files:
HttpConnectionManager.java
Log Message:
changed type of connection status from int to Status.class
Index: HttpConnectionManager.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/gnutella/transfer/HttpConnectionManager.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** HttpConnectionManager.java 16 May 2003 13:02:07 -0000 1.12
--- HttpConnectionManager.java 1 Jun 2003 23:02:36 -0000 1.13
***************
*** 2269,2288 ****
}
! public void connectionStatusChanged(
! ConnectionStatusEvent connectionStatusEvent) {
! if (connectionStatusEvent.getID()
! == ConnectionStatusEvent.CONNECTED) {
synchronized (connections) {
! connections.add(connectionStatusEvent.getSource());
}
synchronized (searchRequestQueue) {
! if (searchRequestQueue.size() > 0 && (timerTask == null)) {
start();
}
}
! } else if (connectionStatusEvent.getID()
! == ConnectionStatusEvent.DISCONNECTED) {
synchronized (connections) {
! connections.remove(connectionStatusEvent.getSource());
}
}
--- 2269,2287 ----
}
! public void connectionStatusChanged(ConnectionStatusEvent event) {
! ziga.connection.Status newStatus = event.getNewStatus();
! if (newStatus == ziga.connection.Status.CONNECTED) {
synchronized (connections) {
! connections.add(event.getSource());
}
synchronized (searchRequestQueue) {
! if (searchRequestQueue.size() > 0
! && (timerTask == null)) {
start();
}
}
! } else if (newStatus.isDisconnected()) {
synchronized (connections) {
! connections.remove(event.getSource());
}
}
|
|
From: Frederik Z. <tri...@us...> - 2003-06-01 23:02:38
|
Update of /cvsroot/ziga/src/ziga/gnutella/connection In directory sc8-pr-cvs1:/tmp/cvs-serv31829/ziga/gnutella/connection Modified Files: GnutellaConnectionHandler.java DefaultConnectionManager.java Added Files: GnutellaStatus.java Log Message: changed type of connection status from int to Status.class --- NEW FILE: GnutellaStatus.java --- /* * 05/29/2003 * * GnutellaStatus.java * Copyright (C) 2003 Frederik Zimmer * tri...@us... * http://sourceforge.net/projects/ziga/ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package ziga.gnutella.connection; import java.util.ResourceBundle; import ziga.connection.Status; import ziga.util.ConnectionStatusComparator; /** * * @author Frederik Zimmer */ public class GnutellaStatus extends Status { protected static final ResourceBundle GNUTELLA_STATUS_MESSAGES = ResourceBundle.getBundle( "ziga.gnutella.connection.resources.StatusMessages"); public static final Status TEMP = new GnutellaStatus(GNUTELLA_STATUS_MESSAGES.getString("TEMP"), false); static { ConnectionStatusComparator.insertBefore(Status.LOGGED_IN, TEMP); } public GnutellaStatus(String statusMessage, boolean errorStatus) { super(statusMessage, errorStatus); } } Index: GnutellaConnectionHandler.java =================================================================== RCS file: /cvsroot/ziga/src/ziga/gnutella/connection/GnutellaConnectionHandler.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnutellaConnectionHandler.java 14 Nov 2002 19:38:37 -0000 1.10 --- GnutellaConnectionHandler.java 1 Jun 2003 23:02:35 -0000 1.11 *************** *** 37,43 **** import ziga.BrowseObserver; ! import ziga.connection.ConnectionStatusEvent; import ziga.connection.ConnectionStatusListener; import ziga.connection.LoginException; import ziga.gnutella.DefaultContentModel; import ziga.gnutella.GUID; --- 37,45 ---- import ziga.BrowseObserver; ! import ziga.connection.AbstractConnectionHandler; import ziga.connection.ConnectionStatusListener; import ziga.connection.LoginException; + import ziga.connection.Status; + import ziga.connection.StatusCustomError; import ziga.gnutella.DefaultContentModel; import ziga.gnutella.GUID; *************** *** 68,79 **** public class GnutellaConnectionHandler implements Runnable, GnutellaHttpFields { - public static final int STATUS_TEMP = 0; - public static final int STATUS_CONNECTING = 1; - public static final int STATUS_HANDSHAKE = 2; - public static final int STATUS_CONNECTED = 3; - public static final int STATUS_CUSTOM_ERROR = -1; - public static final int STATUS_DISCONNECTED_BY_USER = -2; - public static final int STATUS_FULL = -3; protected static final int DEFAULT_SOCKET_TIMEOUT = 30000; protected static final String CONNECT = " CONNECT/"; --- 70,75 ---- public class GnutellaConnectionHandler + extends AbstractConnectionHandler implements Runnable, GnutellaHttpFields { protected static final int DEFAULT_SOCKET_TIMEOUT = 30000; protected static final String CONNECT = " CONNECT/"; *************** *** 86,90 **** protected static final int MY_GGEP_MINOR_VERSION = 5; protected final Object aliveLock = new Object(); ! protected final Object setStatusLock = new Object(); protected EventListenerList listenerList = new EventListenerList(); protected DefaultConnectionManager conManager; --- 82,86 ---- protected static final int MY_GGEP_MINOR_VERSION = 5; protected final Object aliveLock = new Object(); ! protected final Object statusChangeLock = new Object(); protected EventListenerList listenerList = new EventListenerList(); protected DefaultConnectionManager conManager; *************** *** 106,111 **** protected String firstLine; protected byte[] localIP; - protected int status; - protected String customStatus; protected boolean hostcache = false; protected boolean tempConnection; --- 102,105 ---- *************** *** 135,143 **** hostString = remoteIP; this.tempConnection = tempConnection; - if (tempConnection) { - status = STATUS_TEMP; - } else { - status = STATUS_HANDSHAKE; - } incomingConnection = true; browseConnection = false; --- 129,132 ---- *************** *** 175,179 **** hostString = remoteIP + ":" + remotePort; writerThread = new WriterThread(this); - status = STATUS_CONNECTING; incomingConnection = false; tempConnection = false; --- 164,167 ---- *************** *** 432,436 **** rlr = new ReadLineReader(in); ! setStatus(STATUS_HANDSHAKE); out.write(myNetworkName.getBytes()); out.write(LOGINMSG_04.getBytes()); --- 420,424 ---- rlr = new ReadLineReader(in); ! setStatus(Status.HANDSHAKE); out.write(myNetworkName.getBytes()); out.write(LOGINMSG_04.getBytes()); *************** *** 465,469 **** lineOut = new LineWriter(out); ! setStatus(STATUS_HANDSHAKE); sendConnect(lineOut); --- 453,457 ---- lineOut = new LineWriter(out); ! setStatus(Status.HANDSHAKE); sendConnect(lineOut); *************** *** 573,576 **** --- 561,572 ---- out.flush(); } + + protected void setStatus(Status status) { + synchronized (statusChangeLock) { + if (alive) { + super.setStatus(status); + } + } + } public void error(Exception e) { *************** *** 593,597 **** if (wasAlive) { ! setStatus(STATUS_CUSTOM_ERROR, message); stop(); if (browseConnection) { --- 589,593 ---- if (wasAlive) { ! setStatus(new StatusCustomError(message)); stop(); if (browseConnection) { *************** *** 622,628 **** if (wasAlive) { ! synchronized (setStatusLock) { ! if (status >= 0) { ! setStatus(STATUS_DISCONNECTED_BY_USER); } } --- 618,624 ---- if (wasAlive) { ! synchronized (statusChangeLock) { ! if (!status.isDisconnected()) { ! setStatus(Status.DISCONNECTED_BY_USER); } } *************** *** 633,637 **** public void run() { ! fireStatusChanged(ConnectionStatusEvent.CONNECTING); try { --- 629,633 ---- public void run() { ! setStatus(Status.CONNECTING); try { *************** *** 658,662 **** if (alive) { startTime = System.currentTimeMillis(); ! fireStatusChanged(ConnectionStatusEvent.CONNECTED); } --- 654,658 ---- if (alive) { startTime = System.currentTimeMillis(); ! setStatus(Status.CONNECTED); } *************** *** 668,676 **** if (alive) { if (!tempConnection && !browseConnection) { ! setStatus(STATUS_CONNECTED); sendPing(); } if (browseConnection) { ! setStatus(STATUS_TEMP); } --- 664,672 ---- if (alive) { if (!tempConnection && !browseConnection) { ! setStatus(Status.CONNECTED); sendPing(); } if (browseConnection) { ! setStatus(GnutellaStatus.TEMP); } *************** *** 703,707 **** routingTable.route(queryMsg, this); try { ! thread.sleep(10000); } catch (InterruptedException e) { } --- 699,703 ---- routingTable.route(queryMsg, this); try { ! Thread.sleep(10000); } catch (InterruptedException e) { } *************** *** 717,721 **** && (System.currentTimeMillis() - startTime > 10000)) { browseConnection = false; ! setStatus(STATUS_CONNECTED); sendPing(); } --- 713,717 ---- && (System.currentTimeMillis() - startTime > 10000)) { browseConnection = false; ! setStatus(Status.CONNECTED); sendPing(); } *************** *** 761,765 **** && byeMsg.getErrorDescription().length() == 0) { ! setStatus(STATUS_FULL); } alive = false; --- 757,761 ---- && byeMsg.getErrorDescription().length() == 0) { ! setStatus(Status.FULL); } alive = false; *************** *** 803,815 **** close(); ! fireStatusChanged(ConnectionStatusEvent.DISCONNECTED); } public void send(Message msg) { ! if ((status == STATUS_CONNECTED && (!hostcache || (msg.getPayloadDescriptor() == DescriptorHeader.PING && msg.getHops() == 0))) ! || ((status == STATUS_TEMP || browseConnection) && (msg.getPayloadDescriptor() == DescriptorHeader.PONG || msg.getPayloadDescriptor() --- 799,813 ---- close(); ! if (!status.isDisconnected()) { ! setStatus(Status.DISCONNECTED); ! } } public void send(Message msg) { ! if ((status == Status.CONNECTED && (!hostcache || (msg.getPayloadDescriptor() == DescriptorHeader.PING && msg.getHops() == 0))) ! || ((status == GnutellaStatus.TEMP || browseConnection) && (msg.getPayloadDescriptor() == DescriptorHeader.PONG || msg.getPayloadDescriptor() *************** *** 850,854 **** public void sendPriorized(Message msg) { ! if (status == STATUS_CONNECTED) { writerThread.sendPriorized(msg); } --- 848,852 ---- public void sendPriorized(Message msg) { ! if (status == Status.CONNECTED) { writerThread.sendPriorized(msg); } *************** *** 929,944 **** } - public int getStatus() { - synchronized (setStatusLock) { - return status; - } - } - - public String getCustomStatus() { - synchronized (setStatusLock) { - return customStatus; - } - } - protected void close() { if (socket != null) { --- 927,930 ---- *************** *** 963,991 **** public void removeConnectionStatusListener(ConnectionStatusListener l) { listenerList.remove(ConnectionStatusListener.class, l); - } - - protected void setStatus(int newStatus) { - setStatus(newStatus, null); - } - - protected void setStatus(int newStatus, String newCustomStatus) { - synchronized (setStatusLock) { - status = newStatus; - if (newCustomStatus != null) { - customStatus = newCustomStatus; - } - fireStatusChanged(ConnectionStatusEvent.UPDATED); - } - } - - protected void fireStatusChanged(int id) { - ConnectionStatusEvent event = new ConnectionStatusEvent(this, id); - Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length - 2; i >= 0; i -= 2) { - if (listeners[i] == ConnectionStatusListener.class) { - ((ConnectionStatusListener) listeners[i + 1]) - .connectionStatusChanged(event); - } - } } --- 949,952 ---- Index: DefaultConnectionManager.java =================================================================== RCS file: /cvsroot/ziga/src/ziga/gnutella/connection/DefaultConnectionManager.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DefaultConnectionManager.java 3 Jan 2003 13:11:13 -0000 1.8 --- DefaultConnectionManager.java 1 Jun 2003 23:02:35 -0000 1.9 *************** *** 24,47 **** package ziga.gnutella.connection; ! import javax.swing.event.EventListenerList; ! import java.net.Socket; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; - import java.io.BufferedReader; - import java.io.BufferedWriter; import java.io.IOException; ! import java.io.BufferedInputStream; ! import java.io.BufferedOutputStream; import java.util.ArrayList; - import java.util.Iterator; import java.util.StringTokenizer; ! import ziga.*; import ziga.connection.ConnectionStatusEvent; import ziga.connection.ConnectionStatusListener; import ziga.util.Util; - import ziga.gnutella.*; - import ziga.gnutella.message.*; /** --- 24,57 ---- package ziga.gnutella.connection; ! import java.io.BufferedReader; ! import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; ! import java.net.Socket; import java.util.ArrayList; import java.util.StringTokenizer; ! ! import javax.swing.event.EventListenerList; ! ! import ziga.AbstractModule; ! import ziga.BrowseObserver; ! import ziga.ElementAttribute; ! import ziga.ElementModule; ! import ziga.Module; import ziga.connection.ConnectionStatusEvent; import ziga.connection.ConnectionStatusListener; + import ziga.connection.NetworkStatisticsListener; + import ziga.connection.Status; + import ziga.gnutella.DefaultContentModel; + import ziga.gnutella.GUID; + import ziga.gnutella.RoutingTable; + import ziga.gnutella.message.IndexingQueryMessage; + import ziga.gnutella.message.Message; + import ziga.gnutella.message.PingMessage; + import ziga.gnutella.message.PongMessage; import ziga.util.Util; /** *************** *** 573,595 **** } ! public void connectionStatusChanged(ConnectionStatusEvent connectionStatusEvent) { ! GnutellaConnectionHandler con = (GnutellaConnectionHandler) connectionStatusEvent.getSource(); ! ! if (connectionStatusEvent.getID() == ConnectionStatusEvent.UPDATED) { ! synchronized(connections) { ! if (con.status == GnutellaConnectionHandler.STATUS_CONNECTED && getActiveConnectionSize() > maxConnections) { disconnect(con); } } ! } ! else if (connectionStatusEvent.getID() == ConnectionStatusEvent.CONNECTED) { ! synchronized(ipLock) { byte[] conIP = con.getLocalIP(); ! if (conIP != null && ziga.gnutella.util.Util.isPrivateAddress(ip)) { ip = conIP; } } ! } ! else if (connectionStatusEvent.getID() == ConnectionStatusEvent.DISCONNECTED) { removeConnection(con); } --- 583,606 ---- } ! public void connectionStatusChanged(ConnectionStatusEvent event) { ! Status newStatus = event.getNewStatus(); ! GnutellaConnectionHandler con = ! (GnutellaConnectionHandler) event.getSource(); ! ! if (newStatus == Status.CONNECTED) { ! synchronized (connections) { ! if (getActiveConnectionSize() > maxConnections) { disconnect(con); } } ! ! synchronized (ipLock) { byte[] conIP = con.getLocalIP(); ! if (conIP != null ! && ziga.gnutella.util.Util.isPrivateAddress(ip)) { ip = conIP; } } ! } else if (newStatus.isDisconnected()) { removeConnection(con); } *************** *** 607,612 **** GnutellaConnectionHandler con = (GnutellaConnectionHandler) connections.get(i); ! if (con.status == GnutellaConnectionHandler.STATUS_CONNECTED ! || con.status == GnutellaConnectionHandler.STATUS_HANDSHAKE) { conSize++; } --- 618,623 ---- GnutellaConnectionHandler con = (GnutellaConnectionHandler) connections.get(i); ! if (con.getStatus() == Status.CONNECTED ! || con.getStatus() == Status.HANDSHAKE) { conSize++; } *************** *** 828,831 **** --- 839,850 ---- } + public void addNetworkStatisticsListener(NetworkStatisticsListener l) + throws UnsupportedOperationException { + throw new UnsupportedOperationException(); + } + + public void removeNetworkStatisticsListener(NetworkStatisticsListener l) { + } + public ArrayList getHostCaches() { return (ArrayList) hostcaches.clone(); *************** *** 1071,1075 **** long waittime = TIME_BETWEEN_CONNECTS - (System.currentTimeMillis() - lastConnectTime); if (waittime > 0) { ! thread.sleep(waittime); } } --- 1090,1094 ---- long waittime = TIME_BETWEEN_CONNECTS - (System.currentTimeMillis() - lastConnectTime); if (waittime > 0) { ! Thread.sleep(waittime); } } *************** *** 1129,1133 **** } try { ! thread.sleep(80); } catch(InterruptedException e) { e.printStackTrace(); --- 1148,1152 ---- } try { ! Thread.sleep(80); } catch(InterruptedException e) { e.printStackTrace(); *************** *** 1161,1189 **** } ! public void connectionStatusChanged( ! ConnectionStatusEvent connectionStatusEvent) { ! switch (connectionStatusEvent.getID()) { ! case ConnectionStatusEvent.CONNECTING: ! synchronized(connectingList) { ! connectingList.add(connectionStatusEvent.getSource()); ! } ! break; ! case ConnectionStatusEvent.CONNECTED: ! synchronized(connectedList) { ! connectedList.add(connectionStatusEvent.getSource()); ! } ! break; ! case ConnectionStatusEvent.DISCONNECTED: ! synchronized(lock) { ! synchronized(connectingList) { ! synchronized(connectedList) { ! connectingList.remove(connectionStatusEvent.getSource()); ! connectedList.remove(connectionStatusEvent.getSource()); ! } } - - lock.notify(); } ! break; } } --- 1180,1204 ---- } ! public void connectionStatusChanged(ConnectionStatusEvent event) { ! Status newStatus = event.getNewStatus(); ! if (newStatus == Status.CONNECTING) { ! synchronized (connectingList) { ! connectingList.add(event.getSource()); ! } ! } else if (newStatus == Status.CONNECTED) { ! synchronized (connectedList) { ! connectedList.add(event.getSource()); ! } ! } else if (newStatus.isDisconnected()) { ! synchronized (lock) { ! synchronized (connectingList) { ! synchronized (connectedList) { ! connectingList.remove(event.getSource()); ! connectedList.remove(event.getSource()); } } ! ! lock.notify(); ! } } } |
|
From: Frederik Z. <tri...@us...> - 2003-06-01 23:02:38
|
Update of /cvsroot/ziga/src/ziga/gnutella/connection/resources In directory sc8-pr-cvs1:/tmp/cvs-serv31829/ziga/gnutella/connection/resources Added Files: StatusMessages.properties StatusMessages_de.properties Log Message: changed type of connection status from int to Status.class --- NEW FILE: StatusMessages.properties --- TEMP=Temp --- NEW FILE: StatusMessages_de.properties --- TEMP=Temp |
|
From: Frederik Z. <tri...@us...> - 2003-06-01 23:02:27
|
Update of /cvsroot/ziga/src/ziga/gnutella/connection/resources In directory sc8-pr-cvs1:/tmp/cvs-serv31798/ziga/gnutella/connection/resources Log Message: Directory /cvsroot/ziga/src/ziga/gnutella/connection/resources added to the repository |
|
From: Frederik Z. <tri...@us...> - 2003-06-01 22:35:50
|
Update of /cvsroot/ziga/src/ziga/gnutella/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv22972/ziga/gnutella/gui
Modified Files:
ConnectionsComponent.java
Log Message:
changed type of connection status from int to Status.class
Index: ConnectionsComponent.java
===================================================================
RCS file: /cvsroot/ziga/src/ziga/gnutella/gui/ConnectionsComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConnectionsComponent.java 21 Jul 2002 20:55:53 -0000 1.4
--- ConnectionsComponent.java 1 Jun 2003 22:35:47 -0000 1.5
***************
*** 30,34 ****
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
- import java.util.ArrayList;
import javax.swing.BorderFactory;
--- 30,33 ----
***************
*** 43,53 ****
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
! import javax.swing.table.AbstractTableModel;
import ziga.DefaultRootContentModel;
import ziga.ElementModule;
import ziga.Module;
import ziga.connection.ConnectionStatusEvent;
import ziga.connection.ConnectionStatusListener;
import ziga.gnutella.ContentModel;
import ziga.gnutella.connection.ConnectionManager;
--- 42,55 ----
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
! import javax.swing.table.DefaultTableColumnModel;
import ziga.DefaultRootContentModel;
import ziga.ElementModule;
import ziga.Module;
+ import ziga.UnknownElement;
import ziga.connection.ConnectionStatusEvent;
import ziga.connection.ConnectionStatusListener;
+ import ziga.connection.Status;
+ import ziga.connection.StatusCustomError;
import ziga.gnutella.ContentModel;
import ziga.gnutella.connection.ConnectionManager;
***************
*** 55,58 ****
--- 57,67 ----
import ziga.gui.AbstractUserFrontend;
import ziga.gui.NumberTextField;
+ import ziga.gui.event.SortTableHeaderListener;
+ import ziga.gui.table.AbstractAdaptableColumnTableModel;
+ import ziga.gui.table.ColumnSelector;
+ import ziga.gui.table.ConnectionStatusRenderer;
+ import ziga.gui.table.ExtendedTableColumn;
+ import ziga.gui.table.ExtendedTableColumnUtil;
+ import XMLtp.Element;
/**
***************
*** 62,69 ****
public class ConnectionsComponent extends AbstractUserFrontend {
protected ConnectionManager conManager;
protected JPanel mainComponent;
! protected JTable table;
! protected ConnectionsModel tableModel;
protected JTextField ipField;
protected NumberTextField portField;
--- 71,88 ----
public class ConnectionsComponent extends AbstractUserFrontend {
+ protected static final ExtendedTableColumn[] CONNECTIONS_TABLE_COLUMNS = {
+ new ExtendedTableColumn("host", String.class),
+ new ExtendedTableColumn("status", Status.class),
+ new ExtendedTableColumn("userAgent", String.class),
+ new ExtendedTableColumn("type", String.class)
+ };
+ protected static final String CONFIG_CONNECTIONS_TABLE_NAME =
+ "connections";
protected ConnectionManager conManager;
protected JPanel mainComponent;
! protected ExtendedTableColumn[] connectionsColumns;
! protected DefaultTableColumnModel connectionsColumnModel;
! protected ConnectionsModel connectionsModel;
! protected JTable connectionsTable;
protected JTextField ipField;
protected NumberTextField portField;
***************
*** 79,83 ****
public void linkUp() {
! conManager.addConnectionStatusListener(tableModel);
super.linkUp();
}
--- 98,102 ----
public void linkUp() {
! conManager.addConnectionStatusListener(connectionsModel);
super.linkUp();
}
***************
*** 90,93 ****
--- 109,124 ----
((ContentModel) rcm.getModule(ContentModel.class))
.getConnectionManager();
+
+ Element[] e = elementModule.getChildren();
+
+ ExtendedTableColumnUtil.initColumns(
+ CONNECTIONS_TABLE_COLUMNS,
+ getMessagesBundle(),
+ "connections.table.");
+ connectionsColumns =
+ ExtendedTableColumnUtil.getColumns(
+ CONFIG_CONNECTIONS_TABLE_NAME,
+ e,
+ CONNECTIONS_TABLE_COLUMNS);
mainComponent = new JPanel();
***************
*** 100,106 ****
messagesBundle.getString("connections.conTitle")));
! tableModel = new ConnectionsModel();
! table = new JTable(tableModel);
! JScrollPane scrollPane = new JScrollPane(table);
conPanel.add(scrollPane);
--- 131,156 ----
messagesBundle.getString("connections.conTitle")));
! connectionsModel =
! new ConnectionsModel(
! connectionsColumns.length,
! CONNECTIONS_TABLE_COLUMNS);
! connectionsColumnModel =
! ExtendedTableColumnUtil.createDefaultTableColumnModel(
! connectionsColumns);
! connectionsTable =
! new JTable(connectionsModel, connectionsColumnModel);
! connectionsTable.setDefaultRenderer(
! Status.class,
! new ConnectionStatusRenderer());
!
! connectionsTable.getTableHeader().addMouseListener(
! new SortTableHeaderListener(connectionsTable));
!
! connectionsTable.getTableHeader().addMouseListener(
! new ColumnSelector(connectionsTable, CONNECTIONS_TABLE_COLUMNS));
! connectionsColumnModel.addColumnModelListener(
! connectionsModel.new AddRemoveColumnListener());
!
! JScrollPane scrollPane = new JScrollPane(connectionsTable);
conPanel.add(scrollPane);
***************
*** 158,162 ****
super.deinitialize();
! conManager.removeConnectionStatusListener(tableModel);
}
--- 208,232 ----
super.deinitialize();
! conManager.removeConnectionStatusListener(connectionsModel);
!
! Element[] e = elementModule.getChildren();
! if (e != null) {
! for (int i = 0; i < e.length; i++) {
! if (e[i] instanceof UnknownElement
! && e[i].getElementName().equalsIgnoreCase(
! ExtendedTableColumnUtil.TABLE_ELEMENT)) {
! elementModule.removeChild(e[i]);
! }
! }
! }
!
! try {
! Element connectionsTableElement =
! ExtendedTableColumnUtil.getTableElement(
! CONFIG_CONNECTIONS_TABLE_NAME,
! connectionsColumnModel);
! elementModule.addChild(connectionsTableElement);
! } catch (Exception ex) {
! }
}
***************
*** 174,180 ****
protected void disconnect() {
! int[] indices = table.getSelectedRows();
for (int i = 0; i < indices.length; i++) {
! GnutellaConnectionHandler con = tableModel.getEntryAt(indices[i]);
conManager.disconnect(con);
}
--- 244,251 ----
protected void disconnect() {
! int[] indices = connectionsTable.getSelectedRows();
for (int i = 0; i < indices.length; i++) {
! GnutellaConnectionHandler con =
! connectionsModel.getEntryAt(indices[i]);
conManager.disconnect(con);
}
***************
*** 182,222 ****
private class ConnectionsModel
! extends AbstractTableModel
implements ConnectionStatusListener {
! protected String STATUS_TEMP =
! getMessagesBundle().getString("connections.status.temp");
! protected String STATUS_CONNECTING =
! getMessagesBundle().getString("connections.status.connecting");
! protected String STATUS_HANDSHAKE =
! getMessagesBundle().getString("connections.status.handshake");
! protected String STATUS_CONNECTED =
! getMessagesBundle().getString("connections.status.connected");
! protected String STATUS_DISCONNECTED_BY_USER =
! getMessagesBundle().getString(
! "connections.status.disconnectedByUser");
! protected String STATUS_FULL =
! getMessagesBundle().getString("connections.status.full");
! protected String[] columnNames = {
! getMessagesBundle().getString("connections.table.host"),
! getMessagesBundle().getString("connections.table.status"),
! getMessagesBundle().getString("connections.table.userAgent"),
! };
! protected ArrayList connections = new ArrayList();
!
! public int getColumnCount() {
! return columnNames.length;
! }
!
! public int getRowCount() {
! return connections.size();
! }
!
! public String getColumnName(int column) {
! return columnNames[column];
}
! public Object getValueAt(int row, int column) {
GnutellaConnectionHandler handler =
! (GnutellaConnectionHandler) connections.get(row);
switch (column) {
--- 253,273 ----
private class ConnectionsModel
! extends AbstractAdaptableColumnTableModel
implements ConnectionStatusListener {
! private final String TYPE_ULTRAPEER =
! getMessagesBundle().getString("connections.type.ultrapeer");
! private final String TYPE_LEAF =
! getMessagesBundle().getString("connections.type.leaf");
! private final String TYPE_NORMAL =
! getMessagesBundle().getString("connections.type.normal");
! public ConnectionsModel(
! int columnCount,
! ExtendedTableColumn[] columns) {
! super(columnCount, columns);
}
! public Object getValueAt(Object element, int column) {
GnutellaConnectionHandler handler =
! (GnutellaConnectionHandler) element;
switch (column) {
***************
*** 224,248 ****
return handler.getHostString();
case 1 :
! switch (handler.getStatus()) {
! case GnutellaConnectionHandler.STATUS_CONNECTING :
! return STATUS_CONNECTING;
! case GnutellaConnectionHandler.STATUS_HANDSHAKE :
! return STATUS_HANDSHAKE;
! case GnutellaConnectionHandler.STATUS_CONNECTED :
! return STATUS_CONNECTED;
! case GnutellaConnectionHandler.STATUS_CUSTOM_ERROR :
! return handler.getCustomStatus();
! case GnutellaConnectionHandler.STATUS_TEMP :
! return STATUS_TEMP;
! case GnutellaConnectionHandler
! .STATUS_DISCONNECTED_BY_USER :
! return STATUS_DISCONNECTED_BY_USER;
! case GnutellaConnectionHandler.STATUS_FULL :
! return STATUS_FULL;
!
! }
! break;
case 2 :
return handler.getUserAgent();
}
--- 275,293 ----
return handler.getHostString();
case 1 :
! return handler.getStatus();
case 2 :
return handler.getUserAgent();
+ case 3 :
+ if (handler.getStatus() == Status.CONNECTED
+ || handler.getStatus()
+ instanceof StatusCustomError) {
+ if (handler.isUltrapeer()) {
+ return TYPE_ULTRAPEER;
+ } else if (!handler.isRemoteNormalPeer()) {
+ return TYPE_LEAF;
+ } else {
+ return TYPE_NORMAL;
+ }
+ }
}
***************
*** 251,270 ****
public GnutellaConnectionHandler getEntryAt(int row) {
! return (GnutellaConnectionHandler) connections.get(row);
}
! public void connectionStatusChanged(final ConnectionStatusEvent connectionStatusEvent) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
! switch (connectionStatusEvent.getID()) {
! case ConnectionStatusEvent.CONNECTING :
! connections.add(connectionStatusEvent.getSource());
! fireTableDataChanged();
! break;
! case ConnectionStatusEvent.DISCONNECTED :
! delayDisconnectEvent(connectionStatusEvent);
! break;
! default :
! fireTableRowsUpdated(0, getRowCount());
}
}
--- 296,313 ----
public GnutellaConnectionHandler getEntryAt(int row) {
! return (GnutellaConnectionHandler) entries.get(row);
}
! public void connectionStatusChanged(
! final ConnectionStatusEvent event) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
! Status newStatus = event.getNewStatus();
! if (newStatus == Status.CONNECTING) {
! addEntry(event.getSource());
! } else if (newStatus.isDisconnected()) {
! delayDisconnectEvent(event);
! } else {
! fireTableRowsUpdated(0, getRowCount());
}
}
***************
*** 272,286 ****
}
! protected void delayDisconnectEvent(final ConnectionStatusEvent connectionStatusEvent) {
if (connectionStatusEvent.getSource()
! instanceof GnutellaConnectionHandler
! && ((GnutellaConnectionHandler) connectionStatusEvent
! .getSource())
! .getStatus()
! != GnutellaConnectionHandler.STATUS_DISCONNECTED_BY_USER) {
new Thread() {
public void run() {
try {
! Thread.currentThread().sleep(5000);
} catch (InterruptedException e) {
}
--- 315,330 ----
}
! protected void delayDisconnectEvent(
! final ConnectionStatusEvent connectionStatusEvent) {
if (connectionStatusEvent.getSource()
! instanceof GnutellaConnectionHandler
! && ((GnutellaConnectionHandler) connectionStatusEvent
! .getSource())
! .getStatus()
! != Status.DISCONNECTED_BY_USER) {
new Thread() {
public void run() {
try {
! Thread.sleep(5000);
} catch (InterruptedException e) {
}
***************
*** 299,305 ****
}
! private void fireDisconnectEvent(ConnectionStatusEvent connectionStatusEvent) {
! connections.remove(connectionStatusEvent.getSource());
! fireTableDataChanged();
}
--- 343,348 ----
}
! protected void fireDisconnectEvent(ConnectionStatusEvent event) {
! removeEntry(event.getSource());
}
***************
*** 321,325 ****
protected class MinConnectionsDocumentListener
! implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
--- 364,368 ----
protected class MinConnectionsDocumentListener
! implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
***************
*** 339,343 ****
protected class MaxConnectionsDocumentListener
! implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
--- 382,386 ----
protected class MaxConnectionsDocumentListener
! implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
|