Skip to content

Fix crash when releasing dispatch sources in GSMultiHandle #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 0 additions & 51 deletions Source/GSMultiHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,57 +32,6 @@
workQueue: (dispatch_queue_t)workQueque;
- (void) addHandle: (GSEasyHandle*)easyHandle;
- (void) removeHandle: (GSEasyHandle*)easyHandle;
- (void) updateTimeoutTimerToValue: (NSInteger)value;

@end

// What read / write ready event to register / unregister.
typedef NS_ENUM(NSUInteger, GSSocketRegisterActionType) {
GSSocketRegisterActionTypeNone = 0,
GSSocketRegisterActionTypeRegisterRead,
GSSocketRegisterActionTypeRegisterWrite,
GSSocketRegisterActionTypeRegisterReadAndWrite,
GSSocketRegisterActionTypeUnregister,
};

@interface GSSocketRegisterAction : NSObject
{
GSSocketRegisterActionType _type;
}

- (instancetype) initWithRawValue: (int)rawValue;
- (GSSocketRegisterActionType) type;
- (BOOL) needsReadSource;
- (BOOL) needsWriteSource;
- (BOOL) needsSource;

@end

/*
* Read and write libdispatch sources for a specific socket.
*
* A simple helper that combines two sources -- both being optional.
*
* This info is stored into the socket using `curl_multi_assign()`.
*
* - SeeAlso: GSSocketRegisterAction
*/
@interface GSSocketSources : NSObject
{
dispatch_source_t _readSource;
dispatch_source_t _writeSource;
}

- (void) createSourcesWithAction: (GSSocketRegisterAction *)action
socket: (curl_socket_t)socket
queue: (dispatch_queue_t)queue
handler: (dispatch_block_t)handler;
- (dispatch_source_t) createSourceWithType: (dispatch_source_type_t)type
socket: (curl_socket_t)socket
queue: (dispatch_queue_t)queue
handler: (dispatch_block_t)handler;

+ (instancetype) from: (void*)socketSourcePtr;

@end

Expand Down
Loading
Loading