]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/transaction.go
Fix race in file upload handling that may cause panic
[rbdr/mobius] / hotline / transaction.go
index 8fbdf35c0d652a71076c13fe776a625439c59c5c..2994785cca1194c6352ad29281e8090907dfde60 100644 (file)
@@ -40,8 +40,8 @@ const (
        tranGetFileInfo          = 206
        tranSetFileInfo          = 207
        tranMoveFile             = 208
        tranGetFileInfo          = 206
        tranSetFileInfo          = 207
        tranMoveFile             = 208
-       // tranMakeFileAlias        = 209 TODO: implement file alias command
-       tranDownloadFldr = 210
+       tranMakeFileAlias        = 209 // TODO: implement file alias command
+       tranDownloadFldr         = 210
        // tranDownloadInfo         = 211 TODO: implement file transfer queue
        // tranDownloadBanner     = 212 TODO: figure out what this is used for
        tranUploadFldr        = 213
        // tranDownloadInfo         = 211 TODO: implement file transfer queue
        // tranDownloadBanner     = 212 TODO: figure out what this is used for
        tranUploadFldr        = 213
@@ -214,7 +214,7 @@ func ReadFields(paramCount []byte, buf []byte) ([]Field, error) {
        return fields, nil
 }
 
        return fields, nil
 }
 
-func (t Transaction) Payload() []byte {
+func (t Transaction) MarshalBinary() (data []byte, err error) {
        payloadSize := t.Size()
 
        fieldCount := make([]byte, 2)
        payloadSize := t.Size()
 
        fieldCount := make([]byte, 2)
@@ -234,7 +234,7 @@ func (t Transaction) Payload() []byte {
                payloadSize, // this is the dataSize field, but seeming the same as totalSize
                fieldCount,
                fieldPayload,
                payloadSize, // this is the dataSize field, but seeming the same as totalSize
                fieldCount,
                fieldPayload,
-       )
+       ), err
 }
 
 // Size returns the total size of the transaction payload
 }
 
 // Size returns the total size of the transaction payload