51
51
52
52
# The fraction of packets that will be dropped on transmission.
53
53
# This should be 0 for production!
54
- PACKET_LOSS = 0.05
54
+ PACKET_LOSS = 0.00
55
55
56
56
WINDOW_SIZE = 10
57
57
REQ_ACK_AFTER = 5
@@ -936,7 +936,6 @@ class _ClientChannel(object):
936
936
# beginSending() transitions from IDLE to SENDING.
937
937
# processReceivedData() transitions from SENDING to RECEIVING.
938
938
state = None
939
- session = None
940
939
rpcId = None
941
940
currentRpc = None
942
941
outboundMsg = None
@@ -1062,11 +1061,9 @@ def connect(self, service):
1062
1061
header = Header ()
1063
1062
header .direction = Header .CLIENT_TO_SERVER
1064
1063
header .clientSessionHint = self ._id
1065
- header .serverSessionHint = self ._serverSessionHint
1066
- header .sessionToken = self ._token
1067
- header .rpcId = 0
1068
1064
header .serverSessionHint = 0
1069
1065
header .sessionToken = 0
1066
+ header .rpcId = 0
1070
1067
header .channelId = 0
1071
1068
header .payloadType = Header .PT_SESSION_OPEN
1072
1069
self ._transport ._sendOne (self .getAddress (), header , Buffer ([]))
@@ -1089,16 +1086,14 @@ def getAddress(self):
1089
1086
return self ._service .address
1090
1087
1091
1088
def processInboundPacket (self , payloadCM ):
1092
- """Return whether the session is still valid."""
1093
-
1094
1089
self ._lastActivityTime = gettime ()
1095
1090
1096
1091
header = Header .fromString (payloadCM .payload [:Header .LENGTH ])
1097
1092
1098
1093
if header .channelId >= self ._numChannels :
1099
1094
if header .payloadType == Header .PT_SESSION_OPEN :
1100
1095
self ._processSessionOpenResponse (payloadCM )
1101
- return True
1096
+ return
1102
1097
1103
1098
channel = self ._channels [header .channelId ]
1104
1099
if channel .rpcId == header .rpcId :
@@ -1117,12 +1112,9 @@ def processInboundPacket(self, payloadCM):
1117
1112
self ._serverSessionHint = None
1118
1113
self ._token = None
1119
1114
self .connect (self ._service )
1120
- return False
1121
1115
else :
1122
- if (0 < channel .rpcId - header .rpcId < 1024 and
1123
- header .payloadType == Header .PT_DATA and header .requestAck ):
1116
+ if header .payloadType == Header .PT_DATA and header .requestAck :
1124
1117
raise NotImplementedError ("faked full ACK response" )
1125
- return True
1126
1118
1127
1119
def startRpc (self , rpc ):
1128
1120
"""Queue an RPC for transmission on this session.
@@ -1140,15 +1132,6 @@ def startRpc(self, rpc):
1140
1132
channel .currentRpc = rpc
1141
1133
channel .outboundMsg .beginSending (rpc .getRequestBuffer ())
1142
1134
1143
- def getActiveChannels (self ):
1144
- """Used for timers."""
1145
- if not self ._isConnected ():
1146
- return
1147
- for channelId in range (self ._numChannels ):
1148
- channel = self ._channels [channelId ]
1149
- if channel .state != channel .IDLE_STATE :
1150
- yield channelId
1151
-
1152
1135
def close (self ):
1153
1136
debug ("Aborting session" )
1154
1137
for channel in self ._channels :
@@ -1312,9 +1295,7 @@ def _tryProcessPacket(self):
1312
1295
else :
1313
1296
if header .clientSessionHint < len (self ._clientSessions ):
1314
1297
session = self ._clientSessions [header .clientSessionHint ]
1315
- stillValid = session .processInboundPacket (payloadCM )
1316
- if not stillValid :
1317
- self ._clientSessions .put (session )
1298
+ session .processInboundPacket (payloadCM )
1318
1299
return True
1319
1300
1320
1301
def poll (self ):
0 commit comments