Esempio n. 1
0
        public static void SendFile(PUPPort destination, Stream data)
        {
            UInt32      socketID   = SocketIDGenerator.GetNextSocketID();
            EFTPChannel newChannel = new EFTPChannel(destination, socketID);

            _activeChannels.Add(socketID, newChannel);

            EFTPSend.StartSend(newChannel, data);
        }
Esempio n. 2
0
        private EFTPSend(EFTPChannel channel, Stream data)
        {
            _data     = data;
            _channel  = channel;
            _sendDone = false;

            _workerThread = new Thread(SendWorker);
            _workerThread.Start();

            channel.OnDestroy += OnChannelDestroyed;
        }
Esempio n. 3
0
        public static void RecvData(PUP p)
        {
            EFTPChannel channel = FindChannelForPup(p);

            if (channel == null)
            {
                Log.Write(LogType.Error, LogComponent.EFTP, "Received EFTP PUP on an unconnected socket, ignoring.");
                return;
            }

            switch (p.Type)
            {
            case PupType.EFTPData:
            {
                channel.RecvData(p);
            }
            break;

            case PupType.EFTPAck:
            {
                channel.RecvAck(p);
            }
            break;

            case PupType.EFTPEnd:
            {
                channel.End(p);
            }
            break;

            case PupType.EFTPAbort:
            {
                string abortMessage = Helpers.ArrayToString(p.Contents);
                Log.Write(LogType.Warning, LogComponent.RTP, String.Format("EFTP aborted, message: '{0}'", abortMessage));

                DestroyChannel(channel);
            }
            break;

            default:
                throw new NotImplementedException(String.Format("Unhandled EFTP PUP type {0}.", p.Type));
            }
        }
Esempio n. 4
0
 public static void StartSend(EFTPChannel channel, Stream data)
 {
     EFTPSend newSender = new EFTPSend(channel, data);
 }
Esempio n. 5
0
        /// <summary>
        /// Destroys and unregisters the specified channel.
        /// </summary>
        /// <param name="channel"></param>
        public static void DestroyChannel(EFTPChannel channel)
        {
            channel.Destroy();

            _activeChannels.Remove(channel.ServerPort.Socket);
        }