func HandleAeaEnvelopeStream(dhtHandler DHTHandler, stream network.Stream) {
	lerror, _, _, ldebug := dhtHandler.GetLoggers()

	//ldebug().Msgf("Got a new aea envelope stream")

	envel, err := receiveEnvelopeFromPeer(dhtHandler, stream)

	if err != nil {
		lerror(err).Msgf("while reading envelope from peer")
		stream.Close()
		return
	}

	ldebug().Msgf("Received envelope from peer %s", envel.String())
	streamPipe := utils.StreamPipe{Stream: stream}
	acnError := dhtHandler.HandleAeaEnvelope(envel)

	if acnError != nil {
		err = acn.SendAcnError(streamPipe, acnError.Err.Error(), acnError.ErrorCode)
		ignore(err)
		err = stream.Close()
		ignore(err)
		return
	}

	err = acn.SendAcnSuccess(streamPipe)
	ignore(err)
	err = stream.Close()
	ignore(err)
}
// handle envelope stream, handle acn protocol and call dhtHandler.HandleAeaEnvelope for incoming envelopes
handle envelope stream, handle acn protocol and call dhtHandler.HandleAeaEnvelope for incoming envelopes
// handle envelope stream handle acn protocol and call dhtHandler . HandleAeaEnvelope for incoming envelopes
func HandleAeaEnvelopeStream(dhtHandler DHTHandler, stream network.Stream) {
	lerror, _, _, ldebug := dhtHandler.GetLoggers()
	envel, err := receiveEnvelopeFromPeer(dhtHandler, stream)
	if err != nil {
		lerror(err).Msgf("while reading envelope from peer")
		stream.Close()
		return
	}
	ldebug().Msgf("Received envelope from peer %s", envel.String())
	streamPipe := utils.StreamPipe{Stream: stream}
	acnError := dhtHandler.HandleAeaEnvelope(envel)
	if acnError != nil {
		err = acn.SendAcnError(streamPipe, acnError.Err.Error(), acnError.ErrorCode)
		ignore(err)
		err = stream.Close()
		ignore(err)
		return
	}
	err = acn.SendAcnSuccess(streamPipe)
	ignore(err)
	err = stream.Close()
	ignore(err)
}
func HandleAeaEnvelopeStream ( dhtHandler DHTHandler , stream network . Stream ) { lerror , _ , _ , ldebug := dhtHandler . GetLoggers ( ) envel , err := receiveEnvelopeFromPeer ( dhtHandler , stream ) if err != nil { lerror ( err ) . Msgf ( " " ) stream . Close ( ) return } ldebug ( ) . Msgf ( " " , envel . String ( ) ) streamPipe := utils . StreamPipe { Stream : stream } acnError := dhtHandler . HandleAeaEnvelope ( envel ) if acnError != nil { err = acn . SendAcnError ( streamPipe , acnError . Err . Error ( ) , acnError . ErrorCode ) ignore ( err ) err = stream . Close ( ) ignore ( err ) return } err = acn . SendAcnSuccess ( streamPipe ) ignore ( err ) err = stream . Close ( ) ignore ( err ) }
handle envelope stream, handle acn protocol and call dhtHandler.HandleAeaEnvelope for incoming envelopes
handle envelope stream handle acn protocol and call dhtHandler . HandleAeaEnvelope for incoming envelopes
//ldebug().Msgf("Got a new aea envelope stream")