Ejemplo n.º 1
0
 internal SmbComReadAndX(int fid, long offset, int maxCount, ServerMessageBlock andx
                         ) : base(andx)
 {
     this._fid     = fid;
     this._offset  = offset;
     this.MaxCount = MinCount = maxCount;
     Command       = SmbComReadAndx;
     _openTimeout  = unchecked ((int)(0xFFFFFFFF));
 }
Ejemplo n.º 2
0
		internal SmbComReadAndX(int fid, long offset, int maxCount, ServerMessageBlock andx
			) : base(andx)
		{
			this._fid = fid;
			this._offset = offset;
			this.MaxCount = MinCount = maxCount;
			Command = SmbComReadAndx;
			_openTimeout = unchecked((int)(0xFFFFFFFF));
		}
Ejemplo n.º 3
0
        private void Loop()
        {
            //winrt
            //while (Thread!=null&&Thread == Thread.CurrentThread()&& !Thread.IsComplete)
            //TODO
            while (Thread.CurrentThread().Equals(Thread) || !Thread.IsComplete())
            // while (null!=Thread&& !Thread.IsComplete())
            {
                try
                {
                    ServerMessageBlock key = PeekKey();
                    if (key == null)
                    {
                        throw new IOException("end of stream");
                    }


                    lock (this)
                    {
                        Response response = (Response)ResponseMap.Get(key);
                        if (response == null)
                        {
                            if (Log.Level >= 4)
                            {
                                Log.WriteLine("Invalid key, skipping message");
                            }
                            DoSkip();
                        }
                        else
                        {
                            DoRecv(response);
                            response.IsReceived = true;
                            Runtime.NotifyAll(this);
                        }
                    }
                }
                catch (Exception ex)
                {
                    string msg     = ex.Message;
                    bool   timeout = msg != null && msg.Equals("Read timed out");
                    bool   hard    = timeout == false;
                    if (!timeout && Log.Level >= 3)
                    {
                        Runtime.PrintStackTrace(ex, Log);
                    }
                    try
                    {
                        Disconnect(hard);
                    }
                    catch (IOException ioe)
                    {
                        Runtime.PrintStackTrace(ioe, Log);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void Sendrecv(ServerMessageBlock request, Response response, long timeout)
 {
     lock (this)
     {
         MakeKey(request);
         response.IsReceived = false;
         try
         {
             ResponseMap.Put(request, response);
             DoSend(request);
             response.Expiration = Runtime.CurrentTimeMillis() + timeout;
             while (!response.IsReceived)
             {
                 Runtime.Wait(this, timeout);
                 timeout = response.Expiration - Runtime.CurrentTimeMillis();
                 if (timeout <= 0)
                 {
                     throw new TransportException(Name + " timedout waiting for response to " + request
                                                  );
                 }
             }
         }
         catch (IOException ioe)
         {
             if (Log.Level > 2)
             {
                 Runtime.PrintStackTrace(ioe, Log);
             }
             try
             {
                 Disconnect(true);
             }
             catch (IOException ioe2)
             {
                 Runtime.PrintStackTrace(ioe2, Log);
             }
             throw;
         }
         catch (Exception ie)
         {
             throw new TransportException(ie);
         }
         finally
         {
             //Sharpen.Collections.Remove(response_map, request);
             ResponseMap.Remove(request);
         }
     }
 }
Ejemplo n.º 5
0
 /// <exception cref="System.IO.IOException"></exception>
 protected internal abstract void DoSend(ServerMessageBlock request);
Ejemplo n.º 6
0
 /// <exception cref="System.IO.IOException"></exception>
 protected internal abstract void MakeKey(ServerMessageBlock request);
Ejemplo n.º 7
0
 internal SmbComLogoffAndX(ServerMessageBlock andx) : base(andx)
 {
     Command = SmbComLogoffAndx;
 }
Ejemplo n.º 8
0
		internal SmbComLogoffAndX(ServerMessageBlock andx) : base(andx)
		{
			Command = SmbComLogoffAndx;
		}