@@ -123,36 +123,26 @@ static z_result_t _z_unicast_handshake_open(_z_transport_unicast_establish_param
123123 _Z_ERROR_RETURN (_Z_ERR_MESSAGE_UNEXPECTED );
124124 }
125125 _Z_DEBUG ("Received Z_INIT(Ack)" );
126- if (mode == Z_WHATAMI_CLIENT ) {
127- // Any of the size parameters in the InitAck must be less or equal than the one in the InitSyn,
128- // otherwise the InitAck message is considered invalid and it should be treated as a
129- // CLOSE message with L==0 by the Initiating Peer -- the recipient of the InitAck message.
130- if (iam ._body ._init ._seq_num_res <= param -> _seq_num_res ) {
131- param -> _seq_num_res = iam ._body ._init ._seq_num_res ;
132- } else {
133- _Z_ERROR_LOG (_Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION );
134- ret = _Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION ;
135- }
136- if (iam ._body ._init ._req_id_res <= param -> _req_id_res ) {
137- param -> _req_id_res = iam ._body ._init ._req_id_res ;
138- } else {
139- _Z_ERROR_LOG (_Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION );
140- ret = _Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION ;
141- }
142- if (iam ._body ._init ._batch_size <= param -> _batch_size ) {
143- param -> _batch_size = iam ._body ._init ._batch_size ;
144- } else {
145- _Z_ERROR_LOG (_Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION );
146- ret = _Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION ;
147- }
126+ // Any of the size parameters in the InitAck must be less or equal than the one in the InitSyn,
127+ // otherwise the InitAck message is considered invalid and it should be treated as a
128+ // CLOSE message with L==0 by the Initiating Peer -- the recipient of the InitAck message.
129+ if (iam ._body ._init ._seq_num_res <= param -> _seq_num_res ) {
130+ param -> _seq_num_res = iam ._body ._init ._seq_num_res ;
131+ } else {
132+ _Z_ERROR_LOG (_Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION );
133+ ret = _Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION ;
134+ }
135+ if (iam ._body ._init ._req_id_res <= param -> _req_id_res ) {
136+ param -> _req_id_res = iam ._body ._init ._req_id_res ;
137+ } else {
138+ _Z_ERROR_LOG (_Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION );
139+ ret = _Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION ;
140+ }
141+ if (iam ._body ._init ._batch_size <= param -> _batch_size ) {
142+ param -> _batch_size = iam ._body ._init ._batch_size ;
148143 } else {
149- // If the new node has less representing capabilities then it is incompatible to communication
150- if ((iam ._body ._init ._seq_num_res < param -> _seq_num_res ) ||
151- (iam ._body ._init ._req_id_res < param -> _req_id_res ) || (iam ._body ._init ._batch_size < param -> _batch_size )) {
152- _Z_INFO ("Couldn't open session because distant node is incompatible config wise." );
153- _Z_ERROR_LOG (_Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION );
154- ret = _Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION ;
155- }
144+ _Z_ERROR_LOG (_Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION );
145+ ret = _Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION ;
156146 }
157147#if Z_FEATURE_FRAGMENTATION == 1
158148 if (iam ._body ._init ._patch <= ism ._body ._init ._patch ) {
@@ -233,13 +223,21 @@ z_result_t _z_unicast_handshake_listen(_z_transport_unicast_establish_param_t *p
233223 _z_slice_t cookie = _z_slice_null ();
234224 _z_transport_message_t iam = _z_t_msg_make_init_ack (mode , * local_zid , cookie );
235225
236- // If the new node has less representing capabilities then it is incompatible to communication
237- if ((tmsg ._body ._init ._seq_num_res < iam ._body ._init ._seq_num_res ) ||
238- (tmsg ._body ._init ._req_id_res < iam ._body ._init ._req_id_res ) ||
239- (tmsg ._body ._init ._batch_size < iam ._body ._init ._batch_size )) {
240- _z_t_msg_clear (& tmsg );
241- _Z_ERROR_RETURN (_Z_ERR_TRANSPORT_OPEN_SN_RESOLUTION );
226+ // If the new node has less representing capabilities adjust settings
227+ if (tmsg ._body ._init ._seq_num_res < iam ._body ._init ._seq_num_res ) {
228+ _Z_DEBUG ("Adjusting SN resolution from %u to %u" , iam ._body ._init ._seq_num_res , tmsg ._body ._init ._seq_num_res );
229+ iam ._body ._init ._seq_num_res = tmsg ._body ._init ._seq_num_res ;
230+ }
231+ if (tmsg ._body ._init ._req_id_res < iam ._body ._init ._req_id_res ) {
232+ _Z_DEBUG ("Adjusting Req ID resolution from %u to %u" , iam ._body ._init ._req_id_res ,
233+ tmsg ._body ._init ._req_id_res );
234+ iam ._body ._init ._req_id_res = tmsg ._body ._init ._req_id_res ;
242235 }
236+ if (tmsg ._body ._init ._batch_size < iam ._body ._init ._batch_size ) {
237+ _Z_DEBUG ("Adjusting Batch Size from %u to %u" , iam ._body ._init ._batch_size , tmsg ._body ._init ._batch_size );
238+ iam ._body ._init ._batch_size = tmsg ._body ._init ._batch_size ;
239+ }
240+
243241#if Z_FEATURE_FRAGMENTATION == 1
244242 if (iam ._body ._init ._patch > tmsg ._body ._init ._patch ) {
245243 iam ._body ._init ._patch = tmsg ._body ._init ._patch ;
0 commit comments