Event notification: port state
Notify subscribers about port state changes. Signed-off-by: Jiri Benc <jbenc@redhat.com>
This commit is contained in:
		
							parent
							
								
									648197153e
								
							
						
					
					
						commit
						c8c6f7288f
					
				@ -21,7 +21,7 @@
 | 
				
			|||||||
#define HAVE_NOTIFICATION_H
 | 
					#define HAVE_NOTIFICATION_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum notification {
 | 
					enum notification {
 | 
				
			||||||
	NOTIFY_DUMMY,
 | 
						NOTIFY_PORT_STATE,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								port.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								port.c
									
									
									
									
									
								
							@ -2038,6 +2038,7 @@ int port_dispatch(struct port *p, enum fsm_event event, int mdiff)
 | 
				
			|||||||
		if (next == PS_LISTENING && p->delayMechanism == DM_P2P) {
 | 
							if (next == PS_LISTENING && p->delayMechanism == DM_P2P) {
 | 
				
			||||||
			port_set_delay_tmo(p);
 | 
								port_set_delay_tmo(p);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							port_notify_event(p, NOTIFY_PORT_STATE);
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2053,6 +2054,7 @@ int port_dispatch(struct port *p, enum fsm_event event, int mdiff)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p->state = next;
 | 
						p->state = next;
 | 
				
			||||||
 | 
						port_notify_event(p, NOTIFY_PORT_STATE);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2351,7 +2353,9 @@ void port_notify_event(struct port *p, enum notification event)
 | 
				
			|||||||
	int id;
 | 
						int id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (event) {
 | 
						switch (event) {
 | 
				
			||||||
	/* set id */
 | 
						case NOTIFY_PORT_STATE:
 | 
				
			||||||
 | 
							id = PORT_DATA_SET;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user