Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DStore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pr1n19
DStore
Commits
82e8fb33
Commit
82e8fb33
authored
3 years ago
by
pr1n19
Browse files
Options
Downloads
Patches
Plain Diff
Updated messages to controller from "write" to "println" and "flush"
parent
0821cbb7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/DStore.java
+4
-2
4 additions, 2 deletions
src/DStore.java
src/StoreThread.java
+2
-1
2 additions, 1 deletion
src/StoreThread.java
with
6 additions
and
3 deletions
src/DStore.java
+
4
−
2
View file @
82e8fb33
...
@@ -20,7 +20,8 @@ public class DStore {
...
@@ -20,7 +20,8 @@ public class DStore {
controller
=
new
PrintWriter
(
socket
.
getOutputStream
());
controller
=
new
PrintWriter
(
socket
.
getOutputStream
());
//Send "JOIN port" to controller
//Send "JOIN port" to controller
controller
.
write
(
"JOIN "
+
port
);
controller
.
println
(
"JOIN "
+
port
);
controller
.
flush
();
//New thread to listen for "LIST" & "REMOVE FILENAME"
//New thread to listen for "LIST" & "REMOVE FILENAME"
new
Thread
(()
->
{
new
Thread
(()
->
{
...
@@ -105,7 +106,8 @@ public class DStore {
...
@@ -105,7 +106,8 @@ public class DStore {
}
}
//Return value
//Return value
controller
.
write
(
stringList
.
toString
());
controller
.
println
(
stringList
);
controller
.
flush
();
}
}
private
static
void
removeFile
(
String
filePath
,
String
fileName
){
private
static
void
removeFile
(
String
filePath
,
String
fileName
){
...
...
This diff is collapsed.
Click to expand it.
src/StoreThread.java
+
2
−
1
View file @
82e8fb33
...
@@ -36,7 +36,8 @@ public class StoreThread implements Runnable{
...
@@ -36,7 +36,8 @@ public class StoreThread implements Runnable{
fileOutput
.
write
(
buf
);
fileOutput
.
write
(
buf
);
//Send completion ack to controller
//Send completion ack to controller
controller
.
write
(
"STORE_ACK "
+
fileName
);
controller
.
println
(
"STORE_ACK "
+
fileName
);
controller
.
flush
();
//Close file output
//Close file output
fileOutput
.
close
();
fileOutput
.
close
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment