File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,9 @@ impl SocketRecv for RepSocket {
149
149
match self . fair_queue . next ( ) . await {
150
150
Some ( ( peer_id, Ok ( message) ) ) => match message {
151
151
Message :: Message ( mut m) => {
152
- assert ! ( m. len( ) > 1 ) ;
152
+ if m. len ( ) < 2 {
153
+ return Err ( ZmqError :: Other ( "Invalid message format" ) ) ;
154
+ }
153
155
let mut at = 1 ;
154
156
for ( index, frame) in m. iter ( ) . enumerate ( ) {
155
157
if frame. is_empty ( ) {
@@ -163,9 +165,15 @@ impl SocketRecv for RepSocket {
163
165
self . current_request = Some ( peer_id) ;
164
166
return Ok ( data) ;
165
167
}
166
- _ => todo ! ( ) ,
168
+ Message :: Greeting ( _) | Message :: Command ( _) => {
169
+ // Ignore non-message frames. REP sockets should only process actual messages.
170
+ continue ;
171
+ }
167
172
} ,
168
- Some ( ( _peer_id, _) ) => todo ! ( ) ,
173
+ Some ( ( peer_id, Err ( e) ) ) => {
174
+ self . backend . peer_disconnected ( & peer_id) ;
175
+ return Err ( e. into ( ) ) ;
176
+ }
169
177
None => return Err ( ZmqError :: NoMessage ) ,
170
178
} ;
171
179
}
You can’t perform that action at this time.
0 commit comments