예제 #1
0
static void
upnp_event_process_notify(struct upnp_event_notify * obj)
{
	switch(obj->state) {
	case EConnecting:
		/* now connected or failed to connect */
        NP_UPNP_DEBUG("------- upnp_event_process_notify EConnecting switch ----------\n");
		upnp_event_prepare(obj);
		upnp_event_send(obj);
		break;
	case ESending:
        NP_UPNP_DEBUG("------- upnp_event_process_notify ESending switch ----------\n");
		upnp_event_send(obj);
		break;
	case EWaitingForResponse:
        NP_UPNP_DEBUG("------- upnp_event_process_notify EWaitingForResponse switch ----------\n");
		upnp_event_recv(obj);
		break;
	case EFinished:
        NP_UPNP_DEBUG("------- upnp_event_process_notify EFinished switch ----------\n");
		close(obj->s);
		obj->s = -1;
		break;
	default:
		NP_UPNP_ERROR("upnp_event_process_notify: unknown state\n");
	}
}
예제 #2
0
static void
upnp_event_process_notify(struct event *ev)
{
	struct upnp_event_notify *obj = ev->data;

	switch(obj->state) {
	case EConnecting:
		/* now connected or failed to connect */
		upnp_event_prepare(obj);
		upnp_event_send(obj);
		break;
	case ESending:
		upnp_event_send(obj);
		break;
	case EWaitingForResponse:
		upnp_event_recv(obj);
		break;
	case EFinished:
		close(obj->ev.fd);
		obj->ev.fd = -1;
		break;
	default:
		DPRINTF(E_ERROR, L_HTTP, "upnp_event_process_notify: unknown state\n");
	}
}
예제 #3
0
파일: upnpevents.c 프로젝트: irwir/miniupnp
static void
upnp_event_process_notify(struct upnp_event_notify * obj)
{
	int err;
	socklen_t len;
	switch(obj->state) {
	case EConnecting:
		/* now connected or failed to connect */
		len = sizeof(err);
		if(getsockopt(obj->s, SOL_SOCKET, SO_ERROR, &err, &len) < 0) {
			syslog(LOG_ERR, "%s: getsockopt: %m", "upnp_event_process_notify");
			obj->state = EError;
			break;
		}
		if(err != 0) {
			errno = err;
			syslog(LOG_WARNING, "%s: connect(%s%s): %m",
			       "upnp_event_process_notify",
			       obj->addrstr, obj->portstr);
			obj->state = EError;
			break;
		}
		upnp_event_prepare(obj);
		if(obj->state == ESending)
			upnp_event_send(obj);
		break;
	case ESending:
		upnp_event_send(obj);
		break;
	case EWaitingForResponse:
		upnp_event_recv(obj);
		break;
	case EFinished:
		close(obj->s);
		obj->s = -1;
		break;
	default:
		syslog(LOG_ERR, "%s: unknown state", "upnp_event_process_notify");
	}
}
예제 #4
0
static void
upnp_event_process_notify(struct upnp_event_notify * obj)
{
	switch(obj->state) {
	case EConnecting:
		/* now connected or failed to connect */
		upnp_event_prepare(obj);
		upnp_event_send(obj);
		break;
	case ESending:
		upnp_event_send(obj);
		break;
	case EWaitingForResponse:
		upnp_event_recv(obj);
		break;
	case EFinished:
		close(obj->s);
		obj->s = -1;
		break;
	default:
		syslog(LOG_ERR, "upnp_event_process_notify: unknown state");
	}
}