Skip to content

Commit e8ef8dd

Browse files
committed
cami.c: Remove obsolete duplicate reconnect prevention logic.
At one point, logic was added to look for attempts to connect when a session was already ongoing. However, since CAMI switched from a single global session to allowing for multiple sessions, this logic is no longer relevant and can be removed.
1 parent 328e91a commit e8ef8dd

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

cami.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,6 @@ static void *ami_loop(void *varg)
351351
return NULL;
352352
}
353353

354-
/* Try to prevent user applications from blowing things up.
355-
* If ami_connect is called by users when it shouldn't be,
356-
* that could result in starting up multiple AMI connections,
357-
* and then all hell really breaks loose.
358-
* Even though that's a user bug, try to prevent that. */
359-
#define REJECT_DUPLICATE_RECONNECTS 1
360-
361354
struct ami_session *ami_connect(const char *hostname, int port, void (*callback)(struct ami_session *ami, struct ami_event *event), void (*dis_callback)(struct ami_session *ami))
362355
{
363356
int fd;
@@ -372,21 +365,6 @@ struct ami_session *ami_connect(const char *hostname, int port, void (*callback)
372365

373366
pthread_mutex_init(&ami->ami_read_lock, NULL);
374367
pthread_mutex_lock(&ami->ami_read_lock);
375-
if (ami->ami_socket >= 0) {
376-
/* Should pretty much NEVER happen on a clean cleanup
377-
* WILL happen if we reconnect from the disconnect callback */
378-
ami_warning(ami, "Hmm... socket already registered?\n");
379-
/*
380-
* Just continue and overwrite everything.
381-
* It just means that somebody probably called ami_connect twice
382-
* without disconnecting inbetween...
383-
*/
384-
if (REJECT_DUPLICATE_RECONNECTS) {
385-
ami_warning(ami, "Rejecting duplicate AMI connection!\n"); /* Somebody's trying to connect again while there's a connection in progress? */
386-
goto cleanup;
387-
}
388-
ami_cleanup(ami); /* Disconnect to prevent a resource leak */
389-
}
390368

391369
memset(&saddr, 0, sizeof(saddr));
392370
if (!port) {

0 commit comments

Comments
 (0)