@@ -246,13 +246,7 @@ namespace SctpDc { namespace Sctp {
246
246
247
247
void Association::incomingChunk (const InitChunk &chunk)
248
248
{
249
- lastRcvdTsn_ = chunk.initialTsn () - 1 ;
250
- peerVerificationTag_ = chunk.initiateTag ();
251
- remoteWindowCredit_ = chunk.receiverWindowCredit ();
252
- ssthresh_ = remoteWindowCredit_;
253
- inboundStreamsCount_ = chunk.inboundStreamsCount ();
254
- outboundStreamsCount_ = chunk.outboundStreamsCount ();
255
-
249
+ initRemote (chunk);
256
250
if (peerVerificationTag_ == 0 ) {
257
251
abort (Error::VerificationTag);
258
252
return ;
@@ -274,6 +268,18 @@ namespace SctpDc { namespace Sctp {
274
268
sendFirstPriority (packet);
275
269
}
276
270
271
+ void Association::initRemote (const InitChunk &chunk)
272
+ {
273
+ lastRcvdTsn_ = chunk.initialTsn () - 1 ;
274
+ peerVerificationTag_ = chunk.initiateTag ();
275
+ remoteWindowCredit_ = chunk.receiverWindowCredit ();
276
+ ssthresh_ = remoteWindowCredit_;
277
+ inboundStreamsCount_ = chunk.inboundStreamsCount ();
278
+ outboundStreamsCount_ = chunk.outboundStreamsCount ();
279
+ cwnd_ = std::min (4 * mtu_, std::max (2 * mtu_, 4380u ));
280
+ // TODO make congestion window controller
281
+ }
282
+
277
283
void Association::incomingChunk (const InitAckChunk &chunk)
278
284
{
279
285
const auto cookie = chunk.parameter <CookieParameter>();
@@ -282,13 +288,7 @@ namespace SctpDc { namespace Sctp {
282
288
return ;
283
289
}
284
290
285
- // TODO it's a dup of the init block above
286
- lastRcvdTsn_ = chunk.initialTsn () - 1 ;
287
- peerVerificationTag_ = chunk.initiateTag ();
288
- remoteWindowCredit_ = chunk.receiverWindowCredit ();
289
- ssthresh_ = remoteWindowCredit_;
290
- inboundStreamsCount_ = chunk.inboundStreamsCount ();
291
- outboundStreamsCount_ = chunk.outboundStreamsCount ();
291
+ initRemote (chunk);
292
292
293
293
Packet packet;
294
294
packet.appendChunk <CookieEchoChunk>(cookie.value ());
0 commit comments