Browse Source

this performs poorly and unstable

test_udp
Chris Lu 4 years ago
parent
commit
22ef015cff
  1. 3
      weed/server/volume_server_udp_handlers.go
  2. 15
      weed/wdclient/volume_udp_client.go

3
weed/server/volume_server_udp_handlers.go

@ -41,6 +41,7 @@ func (vs *VolumeServer) ServeTFTP(r tftp.ReadRequest) {
func (vs *VolumeServer) ReceiveTFTP(w tftp.WriteRequest) {
filename := w.Name()
println("+ ", filename)
// Get the file size
size, err := w.Size()
@ -75,4 +76,6 @@ func (vs *VolumeServer) ReceiveTFTP(w tftp.WriteRequest) {
return
}
println("- ", filename)
}

15
weed/wdclient/volume_udp_client.go

@ -3,8 +3,8 @@ package wdclient
import (
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"pack.ag/tftp"
"io"
"pack.ag/tftp"
)
// VolumeTcpClient put/get/delete file chunks directly on volume servers without replication
@ -23,15 +23,24 @@ func (c *VolumeUdpClient) PutFileChunk(volumeServerAddress string, fileId string
return parseErr
}
udpClient, _ := tftp.NewClient()
udpClient, _ := tftp.NewClient(
tftp.ClientMode(tftp.ModeOctet),
tftp.ClientBlocksize(9000),
tftp.ClientWindowsize(16),
tftp.ClientTimeout(1),
tftp.ClientTransferSize(true),
tftp.ClientRetransmit(3),
)
fileUrl := "tftp://"+udpAddress+"/"+fileId
fileUrl := "tftp://" + udpAddress + "/" + fileId
// println("put", fileUrl, "...")
err = udpClient.Put(fileUrl, fileReader, int64(fileSize))
if err != nil {
glog.Errorf("udp put %s: %v", fileUrl, err)
return
}
// println("sent", fileUrl)
return
}
Loading…
Cancel
Save