Files
ModemManager/plugins/tests
Aleksander Morgado 7136c0b321 tests,port-context: explicitly close the socket that is added to the listener
Since GLib 2.42, the sockets that are added to socket listeners may no longer
be closed automatically when the listener is finalized. In order to avoid that,
we will keep our own socket reference and close/unref it ourselves.

This issue was preventing adding new test cases with the same port names.

    $ ./test-service-generic --verbose
    GTest: random seed: R02S889153ee0f2e59c570f4edff9caa4176
    GTest: run: /MM/Service/Generic/enable-disable
    Activating service name='org.freedesktop.ModemManager1'
    Successfully activated service 'org.freedesktop.ModemManager1'
    (MSG: DEBUG: client connection closed)
    (MSG: MESSAGE: Found modem at '/org/freedesktop/ModemManager1/Modem/0')
    ** Message: Found modem at '/org/freedesktop/ModemManager1/Modem/0'
    (MSG: DEBUG: client connection closed)
    GTest: result: OK
    GTest: run: /MM/Service/Generic/cme-error-detected
    Activating service name='org.freedesktop.ModemManager1'
    Successfully activated service 'org.freedesktop.ModemManager1'
    (MSG: FATAL-ERROR: Cannot bind socket: Error binding to address: Address already in use)

    ** (/home/aleksander/Development/foss/ModemManager/plugins/.libs/lt-test-service-generic:32043): ERROR **: Cannot bind socket: Error binding to address: Address already in use
2016-01-16 17:59:49 +01:00
..