diff --git a/weed/server/volume_server_udp_handlers.go b/weed/server/volume_server_udp_handlers.go index e0dc94310..2f7563f4c 100644 --- a/weed/server/volume_server_udp_handlers.go +++ b/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) + } diff --git a/weed/wdclient/volume_udp_client.go b/weed/wdclient/volume_udp_client.go index 2daf37bfc..b8bdcec90 100644 --- a/weed/wdclient/volume_udp_client.go +++ b/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 }