Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
perso-distributed-systems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xavier.perret
perso-distributed-systems
Commits
abde012d
Commit
abde012d
authored
2 years ago
by
Xavier Perret
Browse files
Options
Downloads
Patches
Plain Diff
removed prints
parent
3dbe5a81
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lab1/app/manage-connection/manage-connection.go
+2
-1
2 additions, 1 deletion
lab1/app/manage-connection/manage-connection.go
lab1/app/sender/sender.go
+0
-3
0 additions, 3 deletions
lab1/app/sender/sender.go
with
2 additions
and
4 deletions
lab1/app/manage-connection/manage-connection.go
+
2
−
1
View file @
abde012d
...
@@ -18,6 +18,7 @@ func CreateConnection(destinationAddress string) net.Conn {
...
@@ -18,6 +18,7 @@ func CreateConnection(destinationAddress string) net.Conn {
}
}
func
CreateConnectionWithSpecifiedLocalAddress
(
senderAddress
string
,
destinationAddress
string
)
net
.
Conn
{
func
CreateConnectionWithSpecifiedLocalAddress
(
senderAddress
string
,
destinationAddress
string
)
net
.
Conn
{
fmt
.
Println
(
"Trying to connect to "
,
destinationAddress
)
dialer
:=
net
.
Dialer
{
LocalAddr
:
&
net
.
TCPAddr
{
IP
:
net
.
ParseIP
(
senderAddress
)}}
dialer
:=
net
.
Dialer
{
LocalAddr
:
&
net
.
TCPAddr
{
IP
:
net
.
ParseIP
(
senderAddress
)}}
conn
,
err
:=
dialer
.
Dial
(
"tcp"
,
destinationAddress
)
conn
,
err
:=
dialer
.
Dial
(
"tcp"
,
destinationAddress
)
...
@@ -27,4 +28,4 @@ func CreateConnectionWithSpecifiedLocalAddress(senderAddress string, destination
...
@@ -27,4 +28,4 @@ func CreateConnectionWithSpecifiedLocalAddress(senderAddress string, destination
}
}
return
conn
return
conn
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lab1/app/sender/sender.go
+
0
−
3
View file @
abde012d
...
@@ -37,7 +37,6 @@ func SendVoteToNeighbour(config Config, trans Transaction, address string) {
...
@@ -37,7 +37,6 @@ func SendVoteToNeighbour(config Config, trans Transaction, address string) {
func
SendAckToNeighbour
(
config
Config
,
ack
AckTransaction
,
address
string
)
{
func
SendAckToNeighbour
(
config
Config
,
ack
AckTransaction
,
address
string
)
{
fmt
.
Println
(
"*******************STARTING TO SEND ACK*******************"
)
fmt
.
Println
(
"*******************STARTING TO SEND ACK*******************"
)
fmt
.
Println
(
"Trying to connect to "
,
address
)
var
ackToSend
AckTransaction
var
ackToSend
AckTransaction
ackToSend
.
Id
=
ack
.
Id
ackToSend
.
Id
=
ack
.
Id
ackToSend
.
AmountOfCorrectNode
=
ack
.
AmountOfCorrectNode
ackToSend
.
AmountOfCorrectNode
=
ack
.
AmountOfCorrectNode
...
@@ -89,8 +88,6 @@ func SendTransactionToAllNeighbours(config Config, trans Transaction) {
...
@@ -89,8 +88,6 @@ func SendTransactionToAllNeighbours(config Config, trans Transaction) {
func
SendTransactionToNeighbour
(
config
Config
,
trans
Transaction
,
destinationIp
string
,
destinationPort
string
)
{
func
SendTransactionToNeighbour
(
config
Config
,
trans
Transaction
,
destinationIp
string
,
destinationPort
string
)
{
fmt
.
Println
()
fmt
.
Println
()
ipAddr
:=
destinationIp
+
":"
+
destinationPort
ipAddr
:=
destinationIp
+
":"
+
destinationPort
fmt
.
Println
(
"Trying to connect to "
,
destinationIp
,
":"
,
destinationPort
)
conn
:=
manage_connection
.
CreateConnectionWithSpecifiedLocalAddress
(
config
.
Address
,
ipAddr
)
conn
:=
manage_connection
.
CreateConnectionWithSpecifiedLocalAddress
(
config
.
Address
,
ipAddr
)
mess
:=
Message
{
mess
:=
Message
{
...
...
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