-
Notifications
You must be signed in to change notification settings - Fork 7
Contact Information #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| } | ||
| else{ | ||
| try { | ||
| new Thread(fileTransporter.new ListFetcher(controller, new URL("http://"+s+":8080/list"), s)).start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just change this port while testing. Do not commit this change.
| @@ -1,5 +1,6 @@ | |||
| package bishakh.psync; | |||
|
|
|||
| import javax.swing.plaf.basic.BasicInternalFrameTitlePane; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this?
| public volatile ConcurrentHashMap<String, ArrayList<String>> priorityPeerList; | ||
| public volatile ConcurrentHashMap<String, ArrayList<String>> originalPeerList; | ||
|
|
||
| public Discoverer(String BROADCAST_IP, String PEER_ID, int PORT, Logger LoggerObj,File ffile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fileName? what file name. use a better variable name please.
| if(!parent.exists() && !parent.mkdirs()){ | ||
| throw new IllegalStateException("Couldn't create dir: " + parent); | ||
| } | ||
| URL fileUrl = new URL("http://"+ peerIP +":8080/getFile/" + fileID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. port.
| private static String mapFileServerDirectory = "/home/alarm/DMS/"; | ||
| private static String databaseAndLogDirectory = "/home/alarm/DMS/"; | ||
| private static String databaseName = "fileDB.txt"; | ||
| private static String contactFile = "contact.txt"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contactFileName or contactHistoryFileName
more descriptive name = better
| fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger); | ||
| fileTransporter = new FileTransporter(syncDirectory, logger); | ||
| controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, 2, true); | ||
| webServer = new WebServer(8080, controller, logger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
port
| fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger); | ||
| fileTransporter = new FileTransporter(syncDirectory, logger); | ||
| controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, 2, true); | ||
| webServer = new WebServer(8080, controller, logger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
port
| fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger); | ||
| fileTransporter = new FileTransporter(syncDirectory, logger); | ||
| controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, priorityMethod, true); | ||
| webServer = new WebServer(8080, controller, logger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
port
| fileManager = new FileManager(PEER_ID, databaseName, databaseAndLogDirectory, syncDirectory, mapFileServerDirectory, logger); | ||
| fileTransporter = new FileTransporter(syncDirectory, logger); | ||
| controller = new Controller(discoverer, fileManager, fileTransporter, syncInterval, maxRunningDownloads, logger, priorityMethod, restrictedEpidemicFlag); | ||
| webServer = new WebServer(8080, controller, logger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
port
archie94
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documenting codes as you go along is always appreciated, but commenting out code lines adds no value. Kindly remove them.
| if(willUpdatePeer) { | ||
| String peerID = new String(datagramPacket.getData(), 0, datagramPacket.getLength()); | ||
| updatePeers(datagramPacket.getAddress().getHostAddress(), peerID); | ||
| /////////Added code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary comments
| writer.close(); | ||
| for(Map.Entry m:mp.entrySet()) | ||
| { | ||
| //System.out.println(m.getKey()+" "+m.getValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont commit commented codes
| printWriter.println(m.getKey()+" "+m.getValue()); | ||
| } | ||
| printWriter.close(); | ||
| //////////// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary comments
| public SyncService() throws IOException { | ||
|
|
||
| public SyncService() { | ||
| //System.exit(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
| databaseAndLogDirectory = baseDirectory; | ||
| PEER_ID = inputPeerId; | ||
|
|
||
| //System.exit(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
| databaseAndLogDirectory = baseDirectory; | ||
| PEER_ID = inputPeerId; | ||
|
|
||
| //System.exit(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented codes.
| syncDirectory = baseDirectory + File.separator + "sync" + File.separator; | ||
| public SyncService(String inputPeerId, String baseDirectory, int priorityMethod, boolean restrictedEpidemicFlag) throws IOException { | ||
|
|
||
| //System.exit(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
| public SyncService(String inputPeerId, String baseDirectory, int priorityMethod) { | ||
| syncDirectory = baseDirectory + File.separator + "sync" + File.separator; | ||
| public SyncService(String inputPeerId, String baseDirectory, int priorityMethod) throws IOException { | ||
| syncDirectory = baseDirectory +"sync" + "/"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? why this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose my baseDirectory is provided as "C:/Users/Desktop/WorkingDirectory/" (with a trailing '/').
So, no need to give File.separator after baseDirectory unless syncDirectory would be like "C:/Users/Desktop/WorkingDirectory/ \ sync".
And I just mentioned '/' instead of File.separator, it does not create problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay then I am replacing last '/' with File.separator
No description provided.