send file protocal
This commit is contained in:
@@ -1,20 +1,36 @@
|
||||
import threading
|
||||
import copy
|
||||
import os
|
||||
from mswp import Datapack
|
||||
from forwarder import receive_queues, send_queue
|
||||
receive_queue = receive_queues[__name__]
|
||||
|
||||
|
||||
def main():
|
||||
file_flag = False;
|
||||
while True:
|
||||
file_flag = False;
|
||||
raw_data = input()
|
||||
|
||||
if raw_data[:6] == '(file)':
|
||||
raw_data = raw_data[6:]
|
||||
file_flag = True
|
||||
|
||||
first_index, last_index = find_the_last(raw_data)
|
||||
app = raw_data[:first_index]
|
||||
body = raw_data[last_index:]
|
||||
app = app.replace(' ', '')
|
||||
dp = Datapack(head={'from': __name__})
|
||||
dp.app = app
|
||||
dp.body = body.encode()
|
||||
|
||||
if file_flag:
|
||||
dp.method = 'file'
|
||||
dp.body = b''
|
||||
dp.head['filename'] = body
|
||||
|
||||
else:
|
||||
dp.body = body.encode()
|
||||
|
||||
send_queue.put(dp)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user