public void abortBatchRequest() { _m.Lock(); try { if (!initialized()) { Debug.Assert(_batchRequestInProgress); _batchRequestInProgress = false; _m.NotifyAll(); BasicStream dummy = new BasicStream(_reference.getInstance(), Ice.Util.currentProtocolEncoding, _batchAutoFlush); _batchStream.swap(dummy); _batchRequestsSize = Protocol.requestBatchHdr.Length; return; } } finally { _m.Unlock(); } _connection.abortBatchRequest(); }
public void finishBatchRequest(BasicStream os) { _m.Lock(); try { if (!initialized()) { Debug.Assert(_batchRequestInProgress); _batchRequestInProgress = false; _m.NotifyAll(); _batchStream.swap(os); if (!_batchAutoFlush && _batchStream.size() + _batchRequestsSize > _reference.getInstance().messageSizeMax()) { Ex.throwMemoryLimitException(_batchStream.size() + _batchRequestsSize, _reference.getInstance().messageSizeMax()); } _requests.AddLast(new Request(_batchStream)); return; } } finally { _m.Unlock(); } _connection.finishBatchRequest(os, _compress); }
public int Read(byte[] buffer, int offset, int count) { int read = 0; if (BasicStream != null) // not yet created { if (SyncPosition != null) { SyncPosition(_BasicStream); } if (BasicStream.Position < UnreadableHead) { BasicStream.Position = UnreadableHead; } if (CurrentPosition + count < AvaliableLength) { read = BasicStream.Read(buffer, offset, count); } else if (CurrentPosition < AvaliableLength) { read = BasicStream.Read(buffer, offset, (int)(AvaliableLength - CurrentPosition)); } } if (read < count) { // zero the end of the buffer Array.Clear(buffer, offset + read, count - read); read = count; } return(read); }
public override void streamWrite(BasicStream s) { s.startWriteEncaps(); _delegate.streamWriteImpl(s); s.writeString(_resource); s.endWriteEncaps(); }
public EndpointI read(BasicStream s) { lock (this) { short type = s.readShort(); EndpointFactory factory = get(type); EndpointI e = null; s.startReadEncaps(); if (factory != null) { e = factory.read(s); } else { e = new OpaqueEndpointI(type, s); } s.endReadEncaps(); return(e); } }
internal WSEndpoint(ProtocolInstance instance, EndpointI del, BasicStream s) { _instance = instance; _delegate = (IPEndpointI)del; _resource = s.readString(); }
private static void printRequestHeader(System.IO.StringWriter s, BasicStream str) { printIdentityFacetOperation(s, str); try { byte mode = str.readByte(); s.Write("\nmode = " + (int)mode + ' '); switch ((Ice.OperationMode)mode) { case Ice.OperationMode.Normal: { s.Write("(normal)"); break; } case Ice.OperationMode.Nonmutating: { s.Write("(nonmutating)"); break; } case Ice.OperationMode.Idempotent: { s.Write("(idempotent)"); break; } default: { s.Write("(unknown)"); break; } } int sz = str.readSize(); s.Write("\ncontext = "); while (sz-- > 0) { string key = str.readString(); string val = str.readString(); s.Write(key + '/' + val); if (sz > 0) { s.Write(", "); } } Ice.EncodingVersion v = str.skipEncaps(); if (!v.Equals(Ice.Util.Encoding_1_0)) { s.Write("\nencoding = "); s.Write(Ice.Util.encodingVersionToString(v)); } } catch (System.IO.IOException) { Debug.Assert(false); } }
public void writeUserException__(Ice.UserException ex, Ice.FormatType format) { BasicStream os__ = startWriteParams__(format); os__.writeUserException(ex); endWriteParams__(false); }
// // Marshal the endpoint // public override void streamWrite(BasicStream s) { s.writeShort(_type); s.startWriteEncaps(_rawEncoding, Ice.FormatType.DefaultFormat); s.writeBlob(_rawBytes); s.endWriteEncaps(); }
// // These functions allow this object to be reused, rather than reallocated. // public virtual void reset(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) { instance_ = instance; // // Don't recycle the Current object, because servants may keep a reference to it. // current_ = new Ice.Current(); current_.id = new Ice.Identity(); current_.adapter = adapter; current_.con = connection; current_.requestId = requestId; Debug.Assert(cookie_ == null); response_ = response; compress_ = compress; if (response_ && os_ == null) { os_ = new BasicStream(instance, Ice.Util.currentProtocolEncoding); } connection_ = connection; interceptorAsyncCallbackList_ = null; }
public BatchOutgoing(Ice.ConnectionI connection, Instance instance, InvocationObserver observer) { _connection = connection; _sent = false; _observer = observer; _os = new BasicStream(instance, Ice.Util.currentProtocolEncoding); }
public OnewayOutgoingAsync(Ice.ObjectPrxHelperBase prx, string operation, ProxyOnewayCallback <T> cb, object cookie, BasicStream iss, BasicStream os) : base(prx, operation, cookie, iss, os) { Debug.Assert(cb != null); _completed = cb; }
private static byte printHeader(System.IO.StringWriter s, BasicStream str) { try { str.readByte(); // Don't bother printing the magic number str.readByte(); str.readByte(); str.readByte(); /* byte pMajor = */ str.readByte(); /* byte pMinor = */ str.readByte(); //s.Write("\nprotocol version = " + (int)pMajor + "." + (int)pMinor); /* byte eMajor = */ str.readByte(); /* byte eMinor = */ str.readByte(); //s.Write("\nencoding version = " + (int)eMajor + "." + (int)eMinor); byte type = str.readByte(); s.Write("\nmessage type = " + (int)type + " (" + getMessageTypeAsString(type) + ')'); byte compress = str.readByte(); s.Write("\ncompression status = " + (int)compress + ' '); switch (compress) { case (byte)0: { s.Write("(not compressed; do not compress response, if any)"); break; } case (byte)1: { s.Write("(not compressed; compress response, if any)"); break; } case (byte)2: { s.Write("(compressed; compress response, if any)"); break; } default: { s.Write("(unknown)"); break; } } int size = str.readInt(); s.Write("\nmessage size = " + size); return(type); } catch (System.IO.IOException) { Debug.Assert(false); return(0); } }
public BatchOutgoing(RequestHandler handler, InvocationObserver observer) { _handler = handler; _sent = false; _observer = observer; _os = new BasicStream(handler.getReference().getInstance(), Ice.Util.currentProtocolEncoding); Protocol.checkSupportedProtocol(handler.getReference().getProtocol()); }
public IPEndpointI(ProtocolInstance instance, BasicStream s) { instance_ = instance; host_ = s.readString(); port_ = s.readInt(); sourceAddr_ = null; connectionId_ = ""; _hashInitialized = false; }
public Ice.ObjectPrx streamToProxy(BasicStream s) { Ice.Identity ident = new Ice.Identity(); ident.read__(s); Reference r = instance_.referenceFactory().create(ident, s); return(referenceToProxy(r)); }
// // Writeable stream constructor // public StreamWrapper(BasicStream s) { type_ = StreamType.Write; s_ = s; spos_ = s.pos(); bytes_ = new byte[254]; pos_ = 0; length_ = 0; }
// // Readable stream constructor // public StreamWrapper(int size, BasicStream s) { type_ = StreamType.Read; s_ = s; spos_ = 0; bytes_ = null; pos_ = 0; length_ = size; }
// // Marshal the endpoint // public override void streamWrite(BasicStream s) { s.writeShort(Ice.TCPEndpointType.value); s.startWriteEncaps(); s.writeString(_host); s.writeInt(_port); s.writeInt(_timeout); s.writeBool(_compress); s.endWriteEncaps(); }
private static IEnumerable <string> ReadLines(params string[] lines) { WrappedMemoryStream s = Lines(lines); Task <BasicLine[]> task = BasicStream.ReadAsync(s); task.IsCompletedSuccessfully.Should().BeTrue(); s.DisposeCount.Should().Be(1); return(task.Result.Select(l => l.ToString())); }
public OpaqueEndpointI(short type, BasicStream s) { _type = type; _rawEncoding = s.startReadEncaps(); int sz = s.getReadEncapsSize(); _rawBytes = new byte[sz]; s.readBlob(_rawBytes); s.endReadEncaps(); calcHashValue(); }
public TcpEndpointI(BasicStream s) { _instance = s.instance(); s.startReadEncaps(); _host = s.readString(); _port = s.readInt(); _timeout = s.readInt(); _compress = s.readBool(); s.endReadEncaps(); calcHashValue(); }
private static void printRequest(System.IO.StringWriter s, BasicStream str) { int requestId = str.readInt(); s.Write("\nrequest id = " + requestId); if (requestId == 0) { s.Write(" (oneway)"); } printRequestHeader(s, str); }
// // Marshal the endpoint // public override void streamWriteImpl(BasicStream s) { base.streamWriteImpl(s); if (s.getWriteEncoding().Equals(Ice.Util.Encoding_1_0)) { Ice.Util.Protocol_1_0.write__(s); Ice.Util.Encoding_1_0.write__(s); } // Not transmitted. //s.writeBool(_connect); s.writeBool(_compress); }
private static void printBatchRequest(System.IO.StringWriter s, BasicStream str) { int batchRequestNum = str.readInt(); s.Write("\nnumber of requests = " + batchRequestNum); for (int i = 0; i < batchRequestNum; ++i) { s.Write("\nrequest #" + i + ':'); printRequestHeader(s, str); } }
public static void dumpStream(BasicStream stream) { int pos = stream.pos(); stream.pos(0); byte[] data = new byte[stream.size()]; stream.readBlob(data); dumpOctets(data); stream.pos(pos); }
abortBatchRequest(BasicStream os) { lock (this) { if (_batchStreamInUse) { _batchStream.swap(os); _batchStream.resize(_batchMarker, false); _batchStreamInUse = false; System.Threading.Monitor.PulseAll(this); } } }
prepareBatchRequest(BasicStream os) { lock (this) { if (_exception != null) { throw _exception; } waitStreamInUse(false); _batchStreamInUse = true; _batchStream.swap(os); } }
public Outgoing(RequestHandler handler, string operation, Ice.OperationMode mode, Dictionary <string, string> context, InvocationObserver observer) { _state = StateUnsent; _sent = false; _handler = handler; _observer = observer; _encoding = Protocol.getCompatibleEncoding(handler.getReference().getEncoding()); _os = new BasicStream(_handler.getReference().getInstance(), Ice.Util.currentProtocolEncoding); Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_handler.getReference().getProtocol())); writeHeader(operation, mode, context); }
public UdpEndpointI(ProtocolInstance instance, BasicStream s) : base(instance, s) { if (s.getReadEncoding().Equals(Ice.Util.Encoding_1_0)) { s.readByte(); s.readByte(); s.readByte(); s.readByte(); } // Not transmitted. //_connect = s.readBool(); _connect = false; _compress = s.readBool(); }