File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -295,7 +295,6 @@ void intf_shutdown ( struct interface *intf, int rc ) {
295295 * blocked during shutdown.
296296 */
297297void intf_restart ( struct interface * intf , int rc ) {
298- struct interface_descriptor * desc = intf -> desc ;
299298
300299 /* Shut down the interface */
301300 intf_shutdown ( intf , rc );
@@ -309,7 +308,7 @@ void intf_restart ( struct interface *intf, int rc ) {
309308 * infinite loop as the intf_close() operations on each side
310309 * of the link call each other recursively.
311310 */
312- intf -> desc = desc ;
311+ intf_reinit ( intf ) ;
313312}
314313
315314/**
Original file line number Diff line number Diff line change @@ -123,6 +123,11 @@ struct interface {
123123 struct refcnt * refcnt ;
124124 /** Interface descriptor */
125125 struct interface_descriptor * desc ;
126+ /** Original interface descriptor
127+ *
128+ * Used by intf_reinit().
129+ */
130+ struct interface_descriptor * original ;
126131};
127132
128133extern void intf_plug ( struct interface * intf , struct interface * dest );
@@ -166,6 +171,7 @@ static inline void intf_init ( struct interface *intf,
166171 intf -> dest = & null_intf ;
167172 intf -> refcnt = refcnt ;
168173 intf -> desc = desc ;
174+ intf -> original = desc ;
169175}
170176
171177/**
@@ -177,6 +183,7 @@ static inline void intf_init ( struct interface *intf,
177183 .dest = &null_intf, \
178184 .refcnt = NULL, \
179185 .desc = &(descriptor), \
186+ .original = &(descriptor), \
180187 }
181188
182189/**
@@ -236,4 +243,15 @@ static inline void intf_init ( struct interface *intf,
236243 */
237244#define INTF_INTF_DBG ( intf , dest ) INTF_DBG ( intf ), INTF_DBG ( dest )
238245
246+ /**
247+ * Reinitialise an object interface
248+ *
249+ * @v intf Object interface
250+ */
251+ static inline void intf_reinit ( struct interface * intf ) {
252+
253+ /* Restore original interface descriptor */
254+ intf -> desc = intf -> original ;
255+ }
256+
239257#endif /* _IPXE_INTERFACE_H */
Original file line number Diff line number Diff line change @@ -787,12 +787,9 @@ static int http_transfer_complete ( struct http_transaction *http ) {
787787 /* Restart content decoding interfaces (which may be attached
788788 * to the same object).
789789 */
790- intf_nullify ( & http -> content );
791- intf_nullify ( & http -> transfer );
790+ intf_nullify ( & http -> transfer ); /* avoid potential loops */
792791 intf_restart ( & http -> content , http -> response .rc );
793792 intf_restart ( & http -> transfer , http -> response .rc );
794- http -> content .desc = & http_content_desc ;
795- http -> transfer .desc = & http_transfer_desc ;
796793 intf_plug_plug ( & http -> transfer , & http -> content );
797794 http -> len = 0 ;
798795 assert ( http -> remaining == 0 );
You can’t perform that action at this time.
0 commit comments